From a56a45ba84f3f62e7b5b1d32fc42954099827280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Kilchenmann?= Date: Thu, 20 May 2021 17:17:53 +0200 Subject: [PATCH] chore(environment): add test-server config (DSP-1650) (#443) * chore(environment): add test-server config (DSP-1650) * chore: add command to run with test-server config --- angular.json | 32 +++++++++++++++++++++ package.json | 1 + src/config/config.test-server.json | 8 ++++++ src/environments/environment.test-server.ts | 19 ++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 src/config/config.test-server.json create mode 100644 src/environments/environment.test-server.ts diff --git a/angular.json b/angular.json index 6d46e3648c..6a69044b27 100644 --- a/angular.json +++ b/angular.json @@ -71,6 +71,32 @@ "maximumWarning": "6kb" } ] + }, + "test-server": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.test-server.ts" + } + ], + "optimization": false, + "sourceMap": true, + "namedChunks": false, + "aot": true, + "extractLicenses": false, + "vendorChunk": false, + "buildOptimizer": false, + "budgets": [ + { + "type": "initial", + "maximumWarning": "8mb", + "maximumError": "8mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" + } + ] } } }, @@ -82,6 +108,9 @@ "configurations": { "production": { "browserTarget": "dsp-app:build:production" + }, + "test-server": { + "browserTarget": "dsp-app:build:test-server" } } }, @@ -140,6 +169,9 @@ "configurations": { "production": { "devServerTarget": "dsp-app:serve:production" + }, + "test-server": { + "devServerTarget": "dsp-app:serve:test-server" } } }, diff --git a/package.json b/package.json index e2cc2e1583..f67feb3d50 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "scripts": { "ng": "ng", "start": "ng serve", + "start-with-test-server": "ng serve --configuration=test-server", "lint-ci": "eslint --color -c .eslintrc.js --ext .ts ./src/app", "lint-local": "eslint --color --fix -c .eslintrc.js --ext .ts ./src/app", "e2e": "ng e2e", diff --git a/src/config/config.test-server.json b/src/config/config.test-server.json new file mode 100644 index 0000000000..f5f577f7c4 --- /dev/null +++ b/src/config/config.test-server.json @@ -0,0 +1,8 @@ +{ + "apiProtocol": "https", + "apiHost": "api.test.dasch.swiss", + "apiPort": 443, + "apiPath": "", + "jsonWebToken": "", + "logErrors": true +} diff --git a/src/environments/environment.test-server.ts b/src/environments/environment.test-server.ts new file mode 100644 index 0000000000..ac77301a5c --- /dev/null +++ b/src/environments/environment.test-server.ts @@ -0,0 +1,19 @@ +/* + * This file can be replaced during build by using the `fileReplacements` array. + * `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. + * The list of file replacements can be found in `angular.json`. + */ + +export const environment = { + name: 'test-server', + production: false +}; + +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/dist/zone-error'; // Included with Angular CLI.