Skip to content

Commit

Permalink
feat: add lockfile option to control npmrc and ci cache
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Mar 30, 2022
1 parent 7b26e78 commit 776081d
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 24 deletions.
1 change: 0 additions & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down Expand Up @@ -65,7 +64,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Update to workable npm (windows)
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/post-dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down
1 change: 1 addition & 0 deletions lib/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module.exports = {
branches: ['main', 'latest'],
distPaths: ['bin/', 'lib/'],
ciVersions: ['12.13.0', '12.x', '14.15.0', '14.x', '16.0.0', '16.x'],
lockfile: false,
unwantedPackages: [
'eslint',
'eslint-plugin-node',
Expand Down
2 changes: 1 addition & 1 deletion lib/content/npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package-lock=false
package-lock={{lockfile}}
2 changes: 2 additions & 0 deletions lib/content/setup-node.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
- uses: actions/setup-node@v3
with:
node-version: {{#if useMatrix}}$\{{ matrix.node-version }}{{else}}{{#each ciVersions}}{{#if @last}}{{.}}{{/if}}{{/each}}{{/if}}
{{#if lockfile}}
cache: npm
{{/if}}
{{#if useMatrix}}
- name: Update to workable npm (windows)
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
Expand Down
14 changes: 0 additions & 14 deletions tap-snapshots/test/apply/full-content.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down Expand Up @@ -188,7 +187,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down Expand Up @@ -226,7 +224,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: \${{ matrix.node-version }}
cache: npm
- name: Update to workable npm (windows)
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
Expand Down Expand Up @@ -321,7 +318,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down Expand Up @@ -372,7 +368,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down Expand Up @@ -634,7 +629,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down Expand Up @@ -676,7 +670,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down Expand Up @@ -714,7 +707,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: \${{ matrix.node-version }}
cache: npm
- name: Update to workable npm (windows)
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
Expand Down Expand Up @@ -771,7 +763,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down Expand Up @@ -809,7 +800,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: \${{ matrix.node-version }}
cache: npm
- name: Update to workable npm (windows)
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
Expand Down Expand Up @@ -862,7 +852,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down Expand Up @@ -900,7 +889,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: \${{ matrix.node-version }}
cache: npm
- name: Update to workable npm (windows)
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
Expand Down Expand Up @@ -995,7 +983,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down Expand Up @@ -1046,7 +1033,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down
7 changes: 3 additions & 4 deletions tap-snapshots/test/check/diffs.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ The repo file ci.yml needs to be updated:
.github/workflows/ci.yml
========================================
@@ -38,8 +38,9 @@
@@ -37,8 +37,9 @@
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -310,11 +310,11 @@ The repo file ci.yml needs to be updated:
.github/workflows/ci.yml
========================================
@@ -65,4 +65,24 @@
@@ -63,4 +63,24 @@
git config --global user.name "npm cli ops bot"
- uses: actions/setup-node@v3
with:
node-version: \${{ matrix.node-version }}
cache: npm
+ - name: Update to workable npm (windows)
+ # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
+ if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
Expand Down Expand Up @@ -370,7 +370,6 @@ The repo file audit.yml needs to be updated:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Expand Down

0 comments on commit 776081d

Please sign in to comment.