Skip to content

Commit 3891757

Browse files
committed
chore: @npmcli/[email protected]
1 parent 060c2ce commit 3891757

File tree

92 files changed

+1419
-3368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1419
-3368
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const localConfigs = readdir(__dirname)
1111
module.exports = {
1212
root: true,
1313
ignorePatterns: [
14+
'tap-testdir*/',
1415
'docs/**',
1516
'smoke-tests/**',
1617
'mock-globals/**',
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
name: 'Create Check'
4+
inputs:
5+
name:
6+
required: true
7+
token:
8+
required: true
9+
sha:
10+
required: true
11+
check-name:
12+
default: ''
13+
outputs:
14+
check-id:
15+
value: ${{ steps.create-check.outputs.check_id }}
16+
runs:
17+
using: "composite"
18+
steps:
19+
- name: Get Workflow Job
20+
uses: actions/github-script@v6
21+
id: workflow
22+
env:
23+
JOB_NAME: "${{ inputs.name }}"
24+
SHA: "${{ inputs.sha }}"
25+
with:
26+
result-encoding: string
27+
script: |
28+
const { repo: { owner, repo}, runId, serverUrl } = context
29+
const { JOB_NAME, SHA } = process.env
30+
31+
const job = await github.rest.actions.listJobsForWorkflowRun({
32+
owner,
33+
repo,
34+
run_id: runId,
35+
per_page: 100
36+
}).then(r => r.data.jobs.find(j => j.name.endsWith(JOB_NAME)))
37+
38+
return [
39+
`This check is assosciated with ${serverUrl}/${owner}/${repo}/commit/${SHA}.`,
40+
'Run logs:',
41+
job?.html_url || `could not be found for a job ending with: "${JOB_NAME}"`,
42+
].join(' ')
43+
- name: Create Check
44+
uses: LouisBrunner/[email protected]
45+
id: create-check
46+
with:
47+
token: ${{ inputs.token }}
48+
sha: ${{ inputs.sha }}
49+
status: in_progress
50+
name: ${{ inputs.check-name || inputs.name }}
51+
output: |
52+
{"summary":"${{ steps.workflow.outputs.result }}"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
name: 'Install Latest npm'
4+
description: 'Install the latest version of npm compatible with the Node version'
5+
inputs:
6+
node:
7+
description: 'Current Node version'
8+
required: true
9+
runs:
10+
using: "composite"
11+
steps:
12+
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
13+
- name: Update Windows npm
14+
if: |
15+
runner.os == 'Windows' && (
16+
startsWith(inputs.node, 'v10.') ||
17+
startsWith(inputs.node, 'v12.') ||
18+
startsWith(inputs.node, 'v14.')
19+
)
20+
shell: cmd
21+
run: |
22+
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
23+
tar xf npm-7.5.4.tgz
24+
cd package
25+
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
26+
cd ..
27+
rmdir /s /q package
28+
- name: Install Latest npm
29+
shell: bash
30+
env:
31+
NODE_VERSION: ${{ inputs.node }}
32+
working-directory: ${{ runner.temp }}
33+
run: |
34+
MATCH=""
35+
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
36+
37+
echo "node@$NODE_VERSION"
38+
39+
for SPEC in ${SPECS[@]}; do
40+
ENGINES=$(npm view npm@$SPEC --json | jq -r '.engines.node')
41+
echo "Checking if node@$NODE_VERSION satisfies npm@$SPEC ($ENGINES)"
42+
43+
if npx semver -r "$ENGINES" "$NODE_VERSION" > /dev/null; then
44+
MATCH=$SPEC
45+
echo "Found compatible version: npm@$MATCH"
46+
break
47+
fi
48+
done
49+
50+
if [ -z $MATCH ]; then
51+
echo "Could not find a compatible version of npm for node@$NODE_VERSION"
52+
exit 1
53+
fi
54+
55+
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
56+
- name: npm Version
57+
shell: bash
58+
run: npm -v

.github/workflows/audit.yml

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
node-version: 20.x
3131
check-latest: contains('20.x', '.x')
3232
cache: npm
33-
3433
- name: Check Git Status
3534
run: node scripts/git-dirty.js
3635
- name: Reset Deps

.github/workflows/ci-libnpmaccess.yml

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
node-version: 20.x
4040
check-latest: contains('20.x', '.x')
4141
cache: npm
42-
4342
- name: Check Git Status
4443
run: node scripts/git-dirty.js
4544
- name: Reset Deps
@@ -89,7 +88,6 @@ jobs:
8988
node-version: ${{ matrix.node-version }}
9089
check-latest: contains(matrix.node-version, '.x')
9190
cache: npm
92-
9391
- name: Check Git Status
9492
run: node scripts/git-dirty.js
9593
- name: Reset Deps

.github/workflows/ci-libnpmdiff.yml

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
node-version: 20.x
4040
check-latest: contains('20.x', '.x')
4141
cache: npm
42-
4342
- name: Check Git Status
4443
run: node scripts/git-dirty.js
4544
- name: Reset Deps
@@ -89,7 +88,6 @@ jobs:
8988
node-version: ${{ matrix.node-version }}
9089
check-latest: contains(matrix.node-version, '.x')
9190
cache: npm
92-
9391
- name: Check Git Status
9492
run: node scripts/git-dirty.js
9593
- name: Reset Deps

.github/workflows/ci-libnpmexec.yml

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
node-version: 20.x
4040
check-latest: contains('20.x', '.x')
4141
cache: npm
42-
4342
- name: Check Git Status
4443
run: node scripts/git-dirty.js
4544
- name: Reset Deps
@@ -89,7 +88,6 @@ jobs:
8988
node-version: ${{ matrix.node-version }}
9089
check-latest: contains(matrix.node-version, '.x')
9190
cache: npm
92-
9391
- name: Check Git Status
9492
run: node scripts/git-dirty.js
9593
- name: Reset Deps

.github/workflows/ci-libnpmfund.yml

+3-95
Original file line numberDiff line numberDiff line change
@@ -39,60 +39,14 @@ jobs:
3939
node-version: 20.x
4040
check-latest: contains('20.x', '.x')
4141
cache: npm
42-
43-
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
44-
- name: Update Windows npm
45-
if: |
46-
matrix.platform.os == 'windows-latest' && (
47-
startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
48-
)
49-
run: |
50-
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
51-
tar xf npm-7.5.4.tgz
52-
cd package
53-
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
54-
cd ..
55-
rmdir /s /q package
56-
57-
# Start on Node 10 because we dont test on anything lower
58-
- name: Install npm@7 on Node 10
59-
shell: bash
60-
if: startsWith(steps.node.outputs.node-version, 'v10.')
61-
id: npm-7
62-
run: |
63-
npm i --prefer-online --no-fund --no-audit -g npm@7
64-
echo "updated=true" >> "$GITHUB_OUTPUT"
65-
66-
- name: Install npm@8 on Node 12
67-
shell: bash
68-
if: startsWith(steps.node.outputs.node-version, 'v12.')
69-
id: npm-8
70-
run: |
71-
npm i --prefer-online --no-fund --no-audit -g npm@8
72-
echo "updated=true" >> "$GITHUB_OUTPUT"
73-
74-
- name: Install npm@9 on Node 14/16/18.0
75-
shell: bash
76-
if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
77-
id: npm-9
78-
run: |
79-
npm i --prefer-online --no-fund --no-audit -g npm@9
80-
echo "updated=true" >> "$GITHUB_OUTPUT"
81-
82-
- name: Install npm@latest on Node
83-
if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
84-
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
85-
86-
- name: npm Version
87-
run: npm -v
8842
- name: Check Git Status
8943
run: node scripts/git-dirty.js
9044
- name: Reset Deps
9145
run: node scripts/resetdeps.js
9246
- name: Lint
93-
run: npm run lint --ignore-scripts -w libnpmfund
47+
run: node . run lint --ignore-scripts -w libnpmfund
9448
- name: Post Lint
95-
run: npm run postlint --ignore-scripts -w libnpmfund
49+
run: node . run postlint --ignore-scripts -w libnpmfund
9650

9751
test:
9852
name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
@@ -134,59 +88,13 @@ jobs:
13488
node-version: ${{ matrix.node-version }}
13589
check-latest: contains(matrix.node-version, '.x')
13690
cache: npm
137-
138-
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
139-
- name: Update Windows npm
140-
if: |
141-
matrix.platform.os == 'windows-latest' && (
142-
startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
143-
)
144-
run: |
145-
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
146-
tar xf npm-7.5.4.tgz
147-
cd package
148-
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
149-
cd ..
150-
rmdir /s /q package
151-
152-
# Start on Node 10 because we dont test on anything lower
153-
- name: Install npm@7 on Node 10
154-
shell: bash
155-
if: startsWith(steps.node.outputs.node-version, 'v10.')
156-
id: npm-7
157-
run: |
158-
npm i --prefer-online --no-fund --no-audit -g npm@7
159-
echo "updated=true" >> "$GITHUB_OUTPUT"
160-
161-
- name: Install npm@8 on Node 12
162-
shell: bash
163-
if: startsWith(steps.node.outputs.node-version, 'v12.')
164-
id: npm-8
165-
run: |
166-
npm i --prefer-online --no-fund --no-audit -g npm@8
167-
echo "updated=true" >> "$GITHUB_OUTPUT"
168-
169-
- name: Install npm@9 on Node 14/16/18.0
170-
shell: bash
171-
if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
172-
id: npm-9
173-
run: |
174-
npm i --prefer-online --no-fund --no-audit -g npm@9
175-
echo "updated=true" >> "$GITHUB_OUTPUT"
176-
177-
- name: Install npm@latest on Node
178-
if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
179-
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
180-
181-
- name: npm Version
182-
run: npm -v
18391
- name: Check Git Status
18492
run: node scripts/git-dirty.js
18593
- name: Reset Deps
18694
run: node scripts/resetdeps.js
18795
- name: Add Problem Matcher
18896
run: echo "::add-matcher::.github/matchers/tap.json"
18997
- name: Test
190-
run: npm test --ignore-scripts -w libnpmfund
98+
run: node . test --ignore-scripts -w libnpmfund
19199
- name: Check Git Status
192100
run: node scripts/git-dirty.js

.github/workflows/ci-libnpmhook.yml

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
node-version: 20.x
4040
check-latest: contains('20.x', '.x')
4141
cache: npm
42-
4342
- name: Check Git Status
4443
run: node scripts/git-dirty.js
4544
- name: Reset Deps
@@ -89,7 +88,6 @@ jobs:
8988
node-version: ${{ matrix.node-version }}
9089
check-latest: contains(matrix.node-version, '.x')
9190
cache: npm
92-
9391
- name: Check Git Status
9492
run: node scripts/git-dirty.js
9593
- name: Reset Deps

.github/workflows/ci-libnpmorg.yml

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
node-version: 20.x
4040
check-latest: contains('20.x', '.x')
4141
cache: npm
42-
4342
- name: Check Git Status
4443
run: node scripts/git-dirty.js
4544
- name: Reset Deps
@@ -89,7 +88,6 @@ jobs:
8988
node-version: ${{ matrix.node-version }}
9089
check-latest: contains(matrix.node-version, '.x')
9190
cache: npm
92-
9391
- name: Check Git Status
9492
run: node scripts/git-dirty.js
9593
- name: Reset Deps

.github/workflows/ci-libnpmpack.yml

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
node-version: 20.x
4040
check-latest: contains('20.x', '.x')
4141
cache: npm
42-
4342
- name: Check Git Status
4443
run: node scripts/git-dirty.js
4544
- name: Reset Deps
@@ -89,7 +88,6 @@ jobs:
8988
node-version: ${{ matrix.node-version }}
9089
check-latest: contains(matrix.node-version, '.x')
9190
cache: npm
92-
9391
- name: Check Git Status
9492
run: node scripts/git-dirty.js
9593
- name: Reset Deps

.github/workflows/ci-libnpmpublish.yml

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
node-version: 20.x
4040
check-latest: contains('20.x', '.x')
4141
cache: npm
42-
4342
- name: Check Git Status
4443
run: node scripts/git-dirty.js
4544
- name: Reset Deps
@@ -89,7 +88,6 @@ jobs:
8988
node-version: ${{ matrix.node-version }}
9089
check-latest: contains(matrix.node-version, '.x')
9190
cache: npm
92-
9391
- name: Check Git Status
9492
run: node scripts/git-dirty.js
9593
- name: Reset Deps

.github/workflows/ci-libnpmsearch.yml

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
node-version: 20.x
4040
check-latest: contains('20.x', '.x')
4141
cache: npm
42-
4342
- name: Check Git Status
4443
run: node scripts/git-dirty.js
4544
- name: Reset Deps
@@ -89,7 +88,6 @@ jobs:
8988
node-version: ${{ matrix.node-version }}
9089
check-latest: contains(matrix.node-version, '.x')
9190
cache: npm
92-
9391
- name: Check Git Status
9492
run: node scripts/git-dirty.js
9593
- name: Reset Deps

.github/workflows/ci-libnpmteam.yml

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
node-version: 20.x
4040
check-latest: contains('20.x', '.x')
4141
cache: npm
42-
4342
- name: Check Git Status
4443
run: node scripts/git-dirty.js
4544
- name: Reset Deps
@@ -89,7 +88,6 @@ jobs:
8988
node-version: ${{ matrix.node-version }}
9089
check-latest: contains(matrix.node-version, '.x')
9190
cache: npm
92-
9391
- name: Check Git Status
9492
run: node scripts/git-dirty.js
9593
- name: Reset Deps

0 commit comments

Comments
 (0)