@@ -45,7 +45,12 @@ Therefore, GitLab's project-level npm packages registry can freely be used both
You may configure additional [scoped registries](https://docs.npmjs.com/cli/v8/using-npm/scope#associating-a-scope-with-a-registry) with the `$NODE_CONFIG_SCOPED_REGISTRIES` variable.
The value is expected as a (whitespace-separated) list of `@registry-scope:registry-url`.
The Node.js template also supports authentication tokens for each, simply by defining `NODE_REGISTRY_<SCOPE>_AUTH` (as project or group secret variables).
The Node.js template also supports authentication for each, simply by defining the appropriate variable (as project or group secret variables)
:warning: The `<SCOPE>` part is the `registry-scope` transformed in [SCREAMING_SNAKE_CASE](https://en.wikipedia.org/wiki/Snake_case)(uppercase words separated by underscores).
if [[ "${reg_auth_token:-$reg_auth_token_legacy}" ]]
then
log_info " ... set auth token for scope \\e[33;1m${reg_scope}\\e[0m registry"
npm config set "${reg_url_no_proto%/}/:_authToken" "${reg_auth}"
if [[ -z "$reg_auth_token" ]]; then
log_warn " ... auth token should be configured with \\e[33;1m\$NODE_REGISTRY_${reg_scope_ssc}_AUTH_TOKEN\\e[0m instead of \$NODE_REGISTRY_${reg_scope_ssc}_AUTH"
fi
npm config set "${reg_url_no_proto%/}/:_authToken" "${reg_auth_token:-$reg_auth_token_legacy}"
elif [[ "${reg_auth_basic}" ]]
then
log_info " ... set basic auth for scope \\e[33;1m${reg_scope}\\e[0m registry"
npm config set "${reg_url_no_proto%/}/:_auth" "${reg_auth_basic}"