diff --git a/README.md b/README.md index 9183bc2ccda6a02e0cef1c7b8cba09dcc3a53da5..390753a85bc53471ffecf07d45598cc61cbf7fc0 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ The Angular template uses some global configuration used throughout all jobs. |----------------|-----------------------------------------------|:--------------------------------------------------------------------------| | `NG_CLI_IMAGE` | The Docker image used to run Angular-CLI (ng) <br/>:warning: **set the version required by your project** | `trion/ng-cli-karma:latest` | | `NPM_CONFIG_REGISTRY` | NPM [registry](https://docs.npmjs.com/configuring-your-registry-settings-as-an-npm-enterprise-user) | _none_ (defaults to `https://registry.npmjs.org`) | +| `NPM_CONFIG_SCOPED_REGISTRIES` | Space separated list of NPM [scoped registries](https://docs.npmjs.com/cli/v8/using-npm/scope#associating-a-scope-with-a-registry) (formatted as `@somescope:https://some.npm.registry/some/repo @anotherscope:https://another.npm.registry/another/repo`) | _none_ | | `NG_WORKSPACE_DIR` | Angular workspace directory | `.` | ## Jobs diff --git a/kicker.json b/kicker.json index 8f4719acfdc8390f5ee30360090d6440f6bb00f0..bb4ea83f0a67946744bbbb15f10d2f6f439b19ae 100644 --- a/kicker.json +++ b/kicker.json @@ -15,6 +15,11 @@ "type": "url", "advanced": true }, + { + "name": "NPM_CONFIG_SCOPED_REGISTRIES", + "description": "Space separated list of NPM [scoped registries](https://docs.npmjs.com/cli/v8/using-npm/scope#associating-a-scope-with-a-registry) (formatted as `@somescope:https://some.npm.registry/some/repo @anotherscope:https://another.npm.registry/another/repo`)", + "advanced": true + }, { "name": "NG_WORKSPACE_DIR", "description": "Angular workspace directory", diff --git a/templates/gitlab-ci-angular.yml b/templates/gitlab-ci-angular.yml index 3e3d352bd35982a3226d32056d490536d7d84b6b..3bb1bbebb9619915b71c5ab90e399bd4fb6ef39e 100644 --- a/templates/gitlab-ci-angular.yml +++ b/templates/gitlab-ci-angular.yml @@ -35,7 +35,7 @@ variables: NG_E2E_ARGS: >- e2e - + # Angular Build NG_BUILD_ARGS: "build --prod" @@ -412,6 +412,14 @@ stages: - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}" # NPM_CONFIG_REGISTRY is not supported by old npm versions: force with cli - if [[ "$NPM_CONFIG_REGISTRY" ]]; then npm config set registry $NPM_CONFIG_REGISTRY; fi + - | + if [[ "$NPM_CONFIG_SCOPED_REGISTRIES" ]]; + then + for scoped_registry in $NPM_CONFIG_SCOPED_REGISTRIES + do + npm config set "${scoped_registry%%:*}":registry "${scoped_registry#*:}"; + done + fi - configure_gitlab_instance_level_npm_registry_auth - npm ci --cache .npm --prefer-offline