From b8a2cdee7931772e3028ad8ad1b3db2f10fedf8a Mon Sep 17 00:00:00 2001
From: Pierre Smeyers <pierre.smeyers@gmail.com>
Date: Wed, 23 Nov 2022 18:08:14 +0100
Subject: [PATCH] feat: add extra opts to install project deps

---
 README.md                       | 1 +
 kicker.json                     | 5 +++++
 templates/gitlab-ci-angular.yml | 4 ++--
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index f3b9c07..f010ffd 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,7 @@ The Angular template uses some global configuration used throughout all jobs.
 | `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       | `.` |
+| `NG_INSTALL_EXTRA_OPTS`| Extra options to install project dependencies (with [`npm ci`](https://docs.npmjs.com/cli/ci.html/)) | _none_ |
 
 ## Jobs
 
diff --git a/kicker.json b/kicker.json
index 5e5b625..5bf4d4a 100644
--- a/kicker.json
+++ b/kicker.json
@@ -26,6 +26,11 @@
       "default": ".",
       "advanced": true
     },
+    {
+      "name": "NG_INSTALL_EXTRA_OPTS",
+      "description": "Extra options to install project dependencies (with [`npm ci`](https://docs.npmjs.com/cli/ci.html/))",
+      "advanced": true
+    },
     {
       "name": "NG_BUILD_ARGS",
       "description": "Angular [ng build](https://angular.io/cli/build) arguments",
diff --git a/templates/gitlab-ci-angular.yml b/templates/gitlab-ci-angular.yml
index d0be761..3964a9e 100644
--- a/templates/gitlab-ci-angular.yml
+++ b/templates/gitlab-ci-angular.yml
@@ -441,7 +441,7 @@ stages:
         done
       fi
     - configure_gitlab_instance_level_npm_registry_auth
-    - npm ci --cache .npm --prefer-offline
+    - npm ci --cache .npm --prefer-offline $NG_INSTALL_EXTRA_OPTS
 
 ###############################################################################################
 #                                      check stage:                                           #
@@ -530,7 +530,7 @@ ng-publish:
     - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"
     - configure_gitlab_instance_level_npm_registry_auth
     - configure_npm_publish_registry_auth
-    - npm ci --cache .npm --prefer-offline
+    - npm ci --cache .npm --prefer-offline $NG_INSTALL_EXTRA_OPTS
   script:
     - npm_publish
   rules:
-- 
GitLab