From e03ee8edd2edb4804209ed6fe8f4a64da93121f1 Mon Sep 17 00:00:00 2001 From: Jeroen de Bruijn <62570005+jdbruijn@users.noreply.github.com> Date: Thu, 25 Feb 2021 20:02:06 +0100 Subject: [PATCH] ci: run `npm ci` to install and ignore scripts (#104) * ci: run `npm ci` to install and ignore scripts `npm ci` is meant to be used in CI environments and the scripts are ignored to prevent e.g. Husky from being installed in the CI environment. See https://docs.npmjs.com/cli/v7/commands/npm-ci. * ci: run `npm ci` to install and ignore scripts in the Dockerfile --- .github/workflows/ci.yml | 4 ++-- .github/workflows/commitlint.yml | 4 ++-- Dockerfile | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e352c1f..0771630 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm install + - run: npm ci --ignore-scripts - run: npm run lint - run: npm test -- --ci --coverage release: @@ -42,7 +42,7 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm install + - run: npm ci --ignore-scripts - name: Configure git user run: | git config user.email 'github-action@users.noreply.github.com' diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 5a8b5e3..2f704d7 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -21,7 +21,7 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm install + - run: npm ci --ignore-scripts - uses: ./ id: run_commitlint env: @@ -46,7 +46,7 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm install + - run: npm ci --ignore-scripts - uses: ./ env: NODE_PATH: ${{ github.workspace }}/node_modules diff --git a/Dockerfile b/Dockerfile index 570dc9e..05eb6b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ RUN apk --no-cache add git COPY package*.json / -RUN npm ci --production +RUN npm ci --production --ignore-scripts COPY . .