Skip to content

Commit 8873991

Browse files
committedDec 4, 2023
chore: chore: chore: postinstall for dependabot template-oss PR
1 parent f317dc8 commit 8873991

13 files changed

+370
-722
lines changed
 

‎.eslintrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ const localConfigs = readdir(__dirname)
1010

1111
module.exports = {
1212
root: true,
13+
ignorePatterns: [
14+
'tap-testdir*/',
15+
],
1316
extends: [
1417
'@npmcli',
1518
...localConfigs,
+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/checks-action@v1.6.0
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,57 @@
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+
run: |
33+
MATCH=""
34+
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
35+
36+
echo "node@$NODE_VERSION"
37+
38+
for SPEC in ${SPECS[@]}; do
39+
ENGINES=$(npm view npm@$SPEC --json | jq -r '.engines.node')
40+
echo "Checking if node@$NODE_VERSION satisfies npm@$SPEC ($ENGINES)"
41+
42+
if npx semver -r "$ENGINES" "$NODE_VERSION" > /dev/null; then
43+
MATCH=$SPEC
44+
echo "Found compatible version: npm@$MATCH"
45+
break
46+
fi
47+
done
48+
49+
if [ -z $MATCH ]; then
50+
echo "Could not find a compatible version of npm for node@$NODE_VERSION"
51+
exit 1
52+
fi
53+
54+
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
55+
- name: npm Version
56+
shell: bash
57+
run: npm -v

‎.github/workflows/audit.yml

+4-46
Original file line numberDiff line numberDiff line change
@@ -29,52 +29,10 @@ jobs:
2929
with:
3030
node-version: 20.x
3131
check-latest: contains('20.x', '.x')
32-
33-
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
34-
- name: Update Windows npm
35-
if: |
36-
matrix.platform.os == 'windows-latest' && (
37-
startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
38-
)
39-
run: |
40-
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
41-
tar xf npm-7.5.4.tgz
42-
cd package
43-
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
44-
cd ..
45-
rmdir /s /q package
46-
47-
# Start on Node 10 because we dont test on anything lower
48-
- name: Install npm@7 on Node 10
49-
shell: bash
50-
if: startsWith(steps.node.outputs.node-version, 'v10.')
51-
id: npm-7
52-
run: |
53-
npm i --prefer-online --no-fund --no-audit -g npm@7
54-
echo "updated=true" >> "$GITHUB_OUTPUT"
55-
56-
- name: Install npm@8 on Node 12
57-
shell: bash
58-
if: startsWith(steps.node.outputs.node-version, 'v12.')
59-
id: npm-8
60-
run: |
61-
npm i --prefer-online --no-fund --no-audit -g npm@8
62-
echo "updated=true" >> "$GITHUB_OUTPUT"
63-
64-
- name: Install npm@9 on Node 14/16/18.0
65-
shell: bash
66-
if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
67-
id: npm-9
68-
run: |
69-
npm i --prefer-online --no-fund --no-audit -g npm@9
70-
echo "updated=true" >> "$GITHUB_OUTPUT"
71-
72-
- name: Install npm@latest on Node
73-
if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
74-
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
75-
76-
- name: npm Version
77-
run: npm -v
32+
- name: Install Latest npm
33+
uses: ./.github/actions/install-latest-npm
34+
with:
35+
node: ${{ steps.node.outputs.node-version }}
7836
- name: Install Dependencies
7937
run: npm i --ignore-scripts --no-audit --no-fund --package-lock
8038
- name: Run Production Audit

‎.github/workflows/ci-release.yml

+28-182
Original file line numberDiff line numberDiff line change
@@ -27,49 +27,6 @@ jobs:
2727
run:
2828
shell: bash
2929
steps:
30-
- name: Get Workflow Job
31-
uses: actions/github-script@v6
32-
if: inputs.check-sha
33-
id: check-output
34-
env:
35-
JOB_NAME: "Lint All"
36-
MATRIX_NAME: ""
37-
with:
38-
script: |
39-
const { owner, repo } = context.repo
40-
41-
const { data } = await github.rest.actions.listJobsForWorkflowRun({
42-
owner,
43-
repo,
44-
run_id: context.runId,
45-
per_page: 100
46-
})
47-
48-
const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME
49-
const job = data.jobs.find(j => j.name.endsWith(jobName))
50-
const jobUrl = job?.html_url
51-
52-
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ inputs.check-sha }}`
53-
54-
let summary = `This check is assosciated with ${shaUrl}\n\n`
55-
56-
if (jobUrl) {
57-
summary += `For run logs, click here: ${jobUrl}`
58-
} else {
59-
summary += `Run logs could not be found for a job with name: "${jobName}"`
60-
}
61-
62-
return { summary }
63-
- name: Create Check
64-
uses: LouisBrunner/checks-action@v1.6.0
65-
id: check
66-
if: inputs.check-sha
67-
with:
68-
token: ${{ secrets.GITHUB_TOKEN }}
69-
status: in_progress
70-
name: Lint All
71-
sha: ${{ inputs.check-sha }}
72-
output: ${{ steps.check-output.outputs.result }}
7330
- name: Checkout
7431
uses: actions/checkout@v3
7532
with:
@@ -78,58 +35,24 @@ jobs:
7835
run: |
7936
git config --global user.email "npm-cli+bot@github.com"
8037
git config --global user.name "npm CLI robot"
38+
- name: Create Check
39+
id: create-check
40+
if: ${{ inputs.check-sha }}
41+
uses: ./.github/actions/create-check
42+
with:
43+
name: "Lint All"
44+
token: ${{ secrets.GITHUB_TOKEN }}
45+
sha: ${{ inputs.check-sha }}
8146
- name: Setup Node
8247
uses: actions/setup-node@v3
8348
id: node
8449
with:
8550
node-version: 20.x
8651
check-latest: contains('20.x', '.x')
87-
88-
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
89-
- name: Update Windows npm
90-
if: |
91-
matrix.platform.os == 'windows-latest' && (
92-
startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
93-
)
94-
run: |
95-
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
96-
tar xf npm-7.5.4.tgz
97-
cd package
98-
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
99-
cd ..
100-
rmdir /s /q package
101-
102-
# Start on Node 10 because we dont test on anything lower
103-
- name: Install npm@7 on Node 10
104-
shell: bash
105-
if: startsWith(steps.node.outputs.node-version, 'v10.')
106-
id: npm-7
107-
run: |
108-
npm i --prefer-online --no-fund --no-audit -g npm@7
109-
echo "updated=true" >> "$GITHUB_OUTPUT"
110-
111-
- name: Install npm@8 on Node 12
112-
shell: bash
113-
if: startsWith(steps.node.outputs.node-version, 'v12.')
114-
id: npm-8
115-
run: |
116-
npm i --prefer-online --no-fund --no-audit -g npm@8
117-
echo "updated=true" >> "$GITHUB_OUTPUT"
118-
119-
- name: Install npm@9 on Node 14/16/18.0
120-
shell: bash
121-
if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
122-
id: npm-9
123-
run: |
124-
npm i --prefer-online --no-fund --no-audit -g npm@9
125-
echo "updated=true" >> "$GITHUB_OUTPUT"
126-
127-
- name: Install npm@latest on Node
128-
if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
129-
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
130-
131-
- name: npm Version
132-
run: npm -v
52+
- name: Install Latest npm
53+
uses: ./.github/actions/install-latest-npm
54+
with:
55+
node: ${{ steps.node.outputs.node-version }}
13356
- name: Install Dependencies
13457
run: npm i --ignore-scripts --no-audit --no-fund
13558
- name: Lint
@@ -138,11 +61,11 @@ jobs:
13861
run: npm run postlint --ignore-scripts
13962
- name: Conclude Check
14063
uses: LouisBrunner/checks-action@v1.6.0
141-
if: steps.check.outputs.check_id && always()
64+
if: always()
14265
with:
14366
token: ${{ secrets.GITHUB_TOKEN }}
14467
conclusion: ${{ job.status }}
145-
check_id: ${{ steps.check.outputs.check_id }}
68+
check_id: ${{ steps.create-check.outputs.check-id }}
14669

14770
test-all:
14871
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
@@ -173,49 +96,6 @@ jobs:
17396
run:
17497
shell: ${{ matrix.platform.shell }}
17598
steps:
176-
- name: Get Workflow Job
177-
uses: actions/github-script@v6
178-
if: inputs.check-sha
179-
id: check-output
180-
env:
181-
JOB_NAME: "Test All"
182-
MATRIX_NAME: " - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
183-
with:
184-
script: |
185-
const { owner, repo } = context.repo
186-
187-
const { data } = await github.rest.actions.listJobsForWorkflowRun({
188-
owner,
189-
repo,
190-
run_id: context.runId,
191-
per_page: 100
192-
})
193-
194-
const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME
195-
const job = data.jobs.find(j => j.name.endsWith(jobName))
196-
const jobUrl = job?.html_url
197-
198-
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ inputs.check-sha }}`
199-
200-
let summary = `This check is assosciated with ${shaUrl}\n\n`
201-
202-
if (jobUrl) {
203-
summary += `For run logs, click here: ${jobUrl}`
204-
} else {
205-
summary += `Run logs could not be found for a job with name: "${jobName}"`
206-
}
207-
208-
return { summary }
209-
- name: Create Check
210-
uses: LouisBrunner/checks-action@v1.6.0
211-
id: check
212-
if: inputs.check-sha
213-
with:
214-
token: ${{ secrets.GITHUB_TOKEN }}
215-
status: in_progress
216-
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
217-
sha: ${{ inputs.check-sha }}
218-
output: ${{ steps.check-output.outputs.result }}
21999
- name: Checkout
220100
uses: actions/checkout@v3
221101
with:
@@ -224,58 +104,24 @@ jobs:
224104
run: |
225105
git config --global user.email "npm-cli+bot@github.com"
226106
git config --global user.name "npm CLI robot"
107+
- name: Create Check
108+
id: create-check
109+
if: ${{ inputs.check-sha }}
110+
uses: ./.github/actions/create-check
111+
with:
112+
name: "Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
113+
token: ${{ secrets.GITHUB_TOKEN }}
114+
sha: ${{ inputs.check-sha }}
227115
- name: Setup Node
228116
uses: actions/setup-node@v3
229117
id: node
230118
with:
231119
node-version: ${{ matrix.node-version }}
232120
check-latest: contains(matrix.node-version, '.x')
233-
234-
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
235-
- name: Update Windows npm
236-
if: |
237-
matrix.platform.os == 'windows-latest' && (
238-
startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
239-
)
240-
run: |
241-
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
242-
tar xf npm-7.5.4.tgz
243-
cd package
244-
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
245-
cd ..
246-
rmdir /s /q package
247-
248-
# Start on Node 10 because we dont test on anything lower
249-
- name: Install npm@7 on Node 10
250-
shell: bash
251-
if: startsWith(steps.node.outputs.node-version, 'v10.')
252-
id: npm-7
253-
run: |
254-
npm i --prefer-online --no-fund --no-audit -g npm@7
255-
echo "updated=true" >> "$GITHUB_OUTPUT"
256-
257-
- name: Install npm@8 on Node 12
258-
shell: bash
259-
if: startsWith(steps.node.outputs.node-version, 'v12.')
260-
id: npm-8
261-
run: |
262-
npm i --prefer-online --no-fund --no-audit -g npm@8
263-
echo "updated=true" >> "$GITHUB_OUTPUT"
264-
265-
- name: Install npm@9 on Node 14/16/18.0
266-
shell: bash
267-
if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
268-
id: npm-9
269-
run: |
270-
npm i --prefer-online --no-fund --no-audit -g npm@9
271-
echo "updated=true" >> "$GITHUB_OUTPUT"
272-
273-
- name: Install npm@latest on Node
274-
if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
275-
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
276-
277-
- name: npm Version
278-
run: npm -v
121+
- name: Install Latest npm
122+
uses: ./.github/actions/install-latest-npm
123+
with:
124+
node: ${{ steps.node.outputs.node-version }}
279125
- name: Install Dependencies
280126
run: npm i --ignore-scripts --no-audit --no-fund
281127
- name: Add Problem Matcher
@@ -284,8 +130,8 @@ jobs:
284130
run: npm test --ignore-scripts
285131
- name: Conclude Check
286132
uses: LouisBrunner/checks-action@v1.6.0
287-
if: steps.check.outputs.check_id && always()
133+
if: always()
288134
with:
289135
token: ${{ secrets.GITHUB_TOKEN }}
290136
conclusion: ${{ job.status }}
291-
check_id: ${{ steps.check.outputs.check_id }}
137+
check_id: ${{ steps.create-check.outputs.check-id }}

‎.github/workflows/ci.yml

+8-92
Original file line numberDiff line numberDiff line change
@@ -34,52 +34,10 @@ jobs:
3434
with:
3535
node-version: 20.x
3636
check-latest: contains('20.x', '.x')
37-
38-
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
39-
- name: Update Windows npm
40-
if: |
41-
matrix.platform.os == 'windows-latest' && (
42-
startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
43-
)
44-
run: |
45-
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
46-
tar xf npm-7.5.4.tgz
47-
cd package
48-
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
49-
cd ..
50-
rmdir /s /q package
51-
52-
# Start on Node 10 because we dont test on anything lower
53-
- name: Install npm@7 on Node 10
54-
shell: bash
55-
if: startsWith(steps.node.outputs.node-version, 'v10.')
56-
id: npm-7
57-
run: |
58-
npm i --prefer-online --no-fund --no-audit -g npm@7
59-
echo "updated=true" >> "$GITHUB_OUTPUT"
60-
61-
- name: Install npm@8 on Node 12
62-
shell: bash
63-
if: startsWith(steps.node.outputs.node-version, 'v12.')
64-
id: npm-8
65-
run: |
66-
npm i --prefer-online --no-fund --no-audit -g npm@8
67-
echo "updated=true" >> "$GITHUB_OUTPUT"
68-
69-
- name: Install npm@9 on Node 14/16/18.0
70-
shell: bash
71-
if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
72-
id: npm-9
73-
run: |
74-
npm i --prefer-online --no-fund --no-audit -g npm@9
75-
echo "updated=true" >> "$GITHUB_OUTPUT"
76-
77-
- name: Install npm@latest on Node
78-
if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
79-
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
80-
81-
- name: npm Version
82-
run: npm -v
37+
- name: Install Latest npm
38+
uses: ./.github/actions/install-latest-npm
39+
with:
40+
node: ${{ steps.node.outputs.node-version }}
8341
- name: Install Dependencies
8442
run: npm i --ignore-scripts --no-audit --no-fund
8543
- name: Lint
@@ -128,52 +86,10 @@ jobs:
12886
with:
12987
node-version: ${{ matrix.node-version }}
13088
check-latest: contains(matrix.node-version, '.x')
131-
132-
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
133-
- name: Update Windows npm
134-
if: |
135-
matrix.platform.os == 'windows-latest' && (
136-
startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
137-
)
138-
run: |
139-
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
140-
tar xf npm-7.5.4.tgz
141-
cd package
142-
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
143-
cd ..
144-
rmdir /s /q package
145-
146-
# Start on Node 10 because we dont test on anything lower
147-
- name: Install npm@7 on Node 10
148-
shell: bash
149-
if: startsWith(steps.node.outputs.node-version, 'v10.')
150-
id: npm-7
151-
run: |
152-
npm i --prefer-online --no-fund --no-audit -g npm@7
153-
echo "updated=true" >> "$GITHUB_OUTPUT"
154-
155-
- name: Install npm@8 on Node 12
156-
shell: bash
157-
if: startsWith(steps.node.outputs.node-version, 'v12.')
158-
id: npm-8
159-
run: |
160-
npm i --prefer-online --no-fund --no-audit -g npm@8
161-
echo "updated=true" >> "$GITHUB_OUTPUT"
162-
163-
- name: Install npm@9 on Node 14/16/18.0
164-
shell: bash
165-
if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
166-
id: npm-9
167-
run: |
168-
npm i --prefer-online --no-fund --no-audit -g npm@9
169-
echo "updated=true" >> "$GITHUB_OUTPUT"
170-
171-
- name: Install npm@latest on Node
172-
if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
173-
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
174-
175-
- name: npm Version
176-
run: npm -v
89+
- name: Install Latest npm
90+
uses: ./.github/actions/install-latest-npm
91+
with:
92+
node: ${{ steps.node.outputs.node-version }}
17793
- name: Install Dependencies
17894
run: npm i --ignore-scripts --no-audit --no-fund
17995
- name: Add Problem Matcher

‎.github/workflows/post-dependabot.yml

+4-46
Original file line numberDiff line numberDiff line change
@@ -30,52 +30,10 @@ jobs:
3030
with:
3131
node-version: 20.x
3232
check-latest: contains('20.x', '.x')
33-
34-
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
35-
- name: Update Windows npm
36-
if: |
37-
matrix.platform.os == 'windows-latest' && (
38-
startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
39-
)
40-
run: |
41-
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
42-
tar xf npm-7.5.4.tgz
43-
cd package
44-
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
45-
cd ..
46-
rmdir /s /q package
47-
48-
# Start on Node 10 because we dont test on anything lower
49-
- name: Install npm@7 on Node 10
50-
shell: bash
51-
if: startsWith(steps.node.outputs.node-version, 'v10.')
52-
id: npm-7
53-
run: |
54-
npm i --prefer-online --no-fund --no-audit -g npm@7
55-
echo "updated=true" >> "$GITHUB_OUTPUT"
56-
57-
- name: Install npm@8 on Node 12
58-
shell: bash
59-
if: startsWith(steps.node.outputs.node-version, 'v12.')
60-
id: npm-8
61-
run: |
62-
npm i --prefer-online --no-fund --no-audit -g npm@8
63-
echo "updated=true" >> "$GITHUB_OUTPUT"
64-
65-
- name: Install npm@9 on Node 14/16/18.0
66-
shell: bash
67-
if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
68-
id: npm-9
69-
run: |
70-
npm i --prefer-online --no-fund --no-audit -g npm@9
71-
echo "updated=true" >> "$GITHUB_OUTPUT"
72-
73-
- name: Install npm@latest on Node
74-
if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
75-
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
76-
77-
- name: npm Version
78-
run: npm -v
33+
- name: Install Latest npm
34+
uses: ./.github/actions/install-latest-npm
35+
with:
36+
node: ${{ steps.node.outputs.node-version }}
7937
- name: Install Dependencies
8038
run: npm i --ignore-scripts --no-audit --no-fund
8139
- name: Fetch Dependabot Metadata

‎.github/workflows/pull-request.yml

+6-50
Original file line numberDiff line numberDiff line change
@@ -33,62 +33,18 @@ jobs:
3333
with:
3434
node-version: 20.x
3535
check-latest: contains('20.x', '.x')
36-
37-
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
38-
- name: Update Windows npm
39-
if: |
40-
matrix.platform.os == 'windows-latest' && (
41-
startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
42-
)
43-
run: |
44-
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
45-
tar xf npm-7.5.4.tgz
46-
cd package
47-
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
48-
cd ..
49-
rmdir /s /q package
50-
51-
# Start on Node 10 because we dont test on anything lower
52-
- name: Install npm@7 on Node 10
53-
shell: bash
54-
if: startsWith(steps.node.outputs.node-version, 'v10.')
55-
id: npm-7
56-
run: |
57-
npm i --prefer-online --no-fund --no-audit -g npm@7
58-
echo "updated=true" >> "$GITHUB_OUTPUT"
59-
60-
- name: Install npm@8 on Node 12
61-
shell: bash
62-
if: startsWith(steps.node.outputs.node-version, 'v12.')
63-
id: npm-8
64-
run: |
65-
npm i --prefer-online --no-fund --no-audit -g npm@8
66-
echo "updated=true" >> "$GITHUB_OUTPUT"
67-
68-
- name: Install npm@9 on Node 14/16/18.0
69-
shell: bash
70-
if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
71-
id: npm-9
72-
run: |
73-
npm i --prefer-online --no-fund --no-audit -g npm@9
74-
echo "updated=true" >> "$GITHUB_OUTPUT"
75-
76-
- name: Install npm@latest on Node
77-
if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
78-
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
79-
80-
- name: npm Version
81-
run: npm -v
36+
- name: Install Latest npm
37+
uses: ./.github/actions/install-latest-npm
38+
with:
39+
node: ${{ steps.node.outputs.node-version }}
8240
- name: Install Dependencies
8341
run: npm i --ignore-scripts --no-audit --no-fund
8442
- name: Run Commitlint on Commits
8543
id: commit
8644
continue-on-error: true
87-
run: |
88-
npx --offline commitlint -V --from 'origin/${{ github.base_ref }}' --to ${{ github.event.pull_request.head.sha }}
45+
run: npx --offline commitlint -V --from 'origin/${{ github.base_ref }}' --to ${{ github.event.pull_request.head.sha }}
8946
- name: Run Commitlint on PR Title
9047
if: steps.commit.outcome == 'failure'
9148
env:
9249
PR_TITLE: ${{ github.event.pull_request.title }}
93-
run: |
94-
echo "$PR_TITLE" | npx --offline commitlint -V
50+
run: echo "$PR_TITLE" | npx --offline commitlint -V
+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
name: Release Integration
4+
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
releases:
9+
required: true
10+
type: string
11+
description: 'A json array of releases. Required fields: publish: tagName, publishTag. publish check: pkgName, version'
12+
workflow_call:
13+
inputs:
14+
releases:
15+
required: true
16+
type: string
17+
description: 'A json array of releases. Required fields: publish: tagName, publishTag. publish check: pkgName, version'
18+
secrets:
19+
PUBLISH_TOKEN:
20+
required: true
21+
22+
jobs:
23+
publish:
24+
name: Publish
25+
runs-on: ubuntu-latest
26+
defaults:
27+
run:
28+
shell: bash
29+
permissions:
30+
id-token: write
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v3
34+
with:
35+
ref: ${{ fromJSON(inputs.releases)[0].tagName }}
36+
- name: Setup Git User
37+
run: |
38+
git config --global user.email "npm-cli+bot@github.com"
39+
git config --global user.name "npm CLI robot"
40+
- name: Setup Node
41+
uses: actions/setup-node@v3
42+
id: node
43+
with:
44+
node-version: 20.x
45+
check-latest: contains('20.x', '.x')
46+
- name: Install Latest npm
47+
uses: ./.github/actions/install-latest-npm
48+
with:
49+
node: ${{ steps.node.outputs.node-version }}
50+
- name: Install Dependencies
51+
run: npm i --ignore-scripts --no-audit --no-fund
52+
- name: Set npm authToken
53+
run: npm config set '//registry.npmjs.org/:_authToken'=\${PUBLISH_TOKEN}
54+
- name: Publish
55+
env:
56+
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
57+
run: |
58+
EXIT_CODE=0
59+
60+
function each_release {
61+
if npm publish --provenance --tag="$1"; then
62+
echo 0
63+
else
64+
echo 1
65+
fi
66+
}
67+
68+
for release in $(echo '${{ inputs.releases }}' | jq -r '.[] | @base64'); do
69+
PUBLISH_TAG=$(echo "$release" | base64 --decode | jq -r .publishTag)
70+
STATUS=$(each_release "$PUBLISH_TAG")
71+
if [[ "$STATUS" -eq 1 ]]; then
72+
EXIT_CODE=$STATUS
73+
fi
74+
done
75+
76+
exit $EXIT_CODE

‎.github/workflows/release.yml

+122-300
Large diffs are not rendered by default.

‎.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
# ignore everything in the root
44
/*
5+
# transient test directories
6+
tap-testdir*/
57

68
# keep these
79
!**/.gitignore
@@ -34,3 +36,4 @@
3436
!/SECURITY.md
3537
!/tap-snapshots/
3638
!/test/
39+
!/tsconfig.json

‎package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
"scripts": {
77
"test": "tap",
88
"snap": "tap",
9-
"lint": "eslint \"**/*.js\"",
9+
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
1010
"postlint": "template-oss-check",
1111
"lintfix": "npm run lint -- --fix",
1212
"posttest": "npm run lint",
1313
"template-oss-apply": "template-oss-apply --force"
1414
},
1515
"devDependencies": {
1616
"@npmcli/eslint-config": "^4.0.0",
17-
"@npmcli/template-oss": "4.21.0",
17+
"@npmcli/template-oss": "4.21.1",
1818
"tap": "^16.0.0"
1919
},
2020
"license": "ISC",
@@ -53,7 +53,7 @@
5353
"author": "GitHub Inc.",
5454
"templateOSS": {
5555
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
56-
"version": "4.19.0",
56+
"version": "4.21.0",
5757
"engines": ">=10",
5858
"distPaths": [
5959
"classes/",

‎release-please-config.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"exclude-packages-from-root": true,
32
"group-pull-request-title-pattern": "chore: release ${version}",
43
"pull-request-title-pattern": "chore: release${component} ${version}",
54
"changelog-sections": [
@@ -25,12 +24,14 @@
2524
},
2625
{
2726
"type": "chore",
28-
"hidden": true
27+
"section": "Chores",
28+
"hidden": false
2929
}
3030
],
3131
"packages": {
3232
".": {
3333
"package-name": ""
3434
}
35-
}
35+
},
36+
"prerelease-type": "pre"
3637
}

0 commit comments

Comments
 (0)
Please sign in to comment.