Skip to content

Commit 4a97380

Browse files
committed
chore: @npmcli/[email protected]
1 parent 4560e2d commit 4a97380

14 files changed

+864
-130
lines changed

.github/dependabot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 2
44

55
updates:
66
- package-ecosystem: npm
7-
directory: "/"
7+
directory: /
88
schedule:
99
interval: daily
1010
allow:

.github/matchers/tap.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"//@npmcli/template-oss": "This file is automatically added by @npmcli/template-oss. Do not edit.",
3+
"problemMatcher": [
4+
{
5+
"owner": "tap",
6+
"pattern": [
7+
{
8+
"regexp": "^\\s*not ok \\d+ - (.*)",
9+
"message": 1
10+
},
11+
{
12+
"regexp": "^\\s*---"
13+
},
14+
{
15+
"regexp": "^\\s*at:"
16+
},
17+
{
18+
"regexp": "^\\s*line:\\s*(\\d+)",
19+
"line": 1
20+
},
21+
{
22+
"regexp": "^\\s*column:\\s*(\\d+)",
23+
"column": 1
24+
},
25+
{
26+
"regexp": "^\\s*file:\\s*(.*)",
27+
"file": 1
28+
}
29+
]
30+
}
31+
]
32+
}

.github/workflows/audit.yml

+19-9
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,33 @@ name: Audit
55
on:
66
workflow_dispatch:
77
schedule:
8-
# "At 01:00 on Monday" https://crontab.guru/#0_1_*_*_1
9-
- cron: "0 1 * * 1"
8+
# "At 08:00 UTC (01:00 PT) on Monday" https://crontab.guru/#0_8_*_*_1
9+
- cron: "0 8 * * 1"
1010

1111
jobs:
1212
audit:
13+
name: Audit Dependencies
14+
if: github.repository_owner == 'npm'
1315
runs-on: ubuntu-latest
16+
defaults:
17+
run:
18+
shell: bash
1419
steps:
15-
- uses: actions/checkout@v3
16-
- name: Setup git user
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
- name: Setup Git User
1723
run: |
1824
git config --global user.email "[email protected]"
1925
git config --global user.name "npm CLI robot"
20-
- uses: actions/setup-node@v3
26+
- name: Setup Node
27+
uses: actions/setup-node@v3
2128
with:
2229
node-version: 16.x
23-
- name: Update npm to latest
30+
- name: Install npm@latest
2431
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
25-
- run: npm -v
26-
- run: npm i --ignore-scripts --no-audit --no-fund --package-lock
27-
- run: npm audit
32+
- name: npm Version
33+
run: npm -v
34+
- name: Install Dependencies
35+
run: npm i --ignore-scripts --no-audit --no-fund --package-lock
36+
- name: Run Audit
37+
run: npm audit

.github/workflows/ci-release.yml

+216
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
name: CI - Release
4+
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
ref:
9+
required: true
10+
type: string
11+
default: main
12+
workflow_call:
13+
inputs:
14+
ref:
15+
required: true
16+
type: string
17+
check-sha:
18+
required: true
19+
type: string
20+
21+
jobs:
22+
lint-all:
23+
name: Lint All
24+
if: github.repository_owner == 'npm'
25+
runs-on: ubuntu-latest
26+
defaults:
27+
run:
28+
shell: bash
29+
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/[email protected]
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 }}
73+
- name: Checkout
74+
uses: actions/checkout@v3
75+
with:
76+
ref: ${{ inputs.ref }}
77+
- name: Setup Git User
78+
run: |
79+
git config --global user.email "[email protected]"
80+
git config --global user.name "npm CLI robot"
81+
- name: Setup Node
82+
uses: actions/setup-node@v3
83+
with:
84+
node-version: 16.x
85+
- name: Install npm@latest
86+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
87+
- name: npm Version
88+
run: npm -v
89+
- name: Install Dependencies
90+
run: npm i --ignore-scripts --no-audit --no-fund
91+
- name: Lint
92+
run: npm run lint --ignore-scripts
93+
- name: Post Lint
94+
run: npm run postlint --ignore-scripts
95+
- name: Conclude Check
96+
uses: LouisBrunner/[email protected]
97+
if: steps.check.outputs.check_id && always()
98+
with:
99+
token: ${{ secrets.GITHUB_TOKEN }}
100+
conclusion: ${{ job.status }}
101+
check_id: ${{ steps.check.outputs.check_id }}
102+
103+
test-all:
104+
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
105+
if: github.repository_owner == 'npm'
106+
strategy:
107+
fail-fast: false
108+
matrix:
109+
platform:
110+
- name: Linux
111+
os: ubuntu-latest
112+
shell: bash
113+
- name: macOS
114+
os: macos-latest
115+
shell: bash
116+
- name: Windows
117+
os: windows-latest
118+
shell: cmd
119+
node-version:
120+
- 12.13.0
121+
- 12.x
122+
- 14.15.0
123+
- 14.x
124+
- 16.0.0
125+
- 16.x
126+
runs-on: ${{ matrix.platform.os }}
127+
defaults:
128+
run:
129+
shell: ${{ matrix.platform.shell }}
130+
steps:
131+
- name: Get Workflow Job
132+
uses: actions/github-script@v6
133+
if: inputs.check-sha
134+
id: check-output
135+
env:
136+
JOB_NAME: "Test All"
137+
MATRIX_NAME: " - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
138+
with:
139+
script: |
140+
const { owner, repo } = context.repo
141+
142+
const { data } = await github.rest.actions.listJobsForWorkflowRun({
143+
owner,
144+
repo,
145+
run_id: context.runId,
146+
per_page: 100
147+
})
148+
149+
const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME
150+
const job = data.jobs.find(j => j.name.endsWith(jobName))
151+
const jobUrl = job?.html_url
152+
153+
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ inputs.check-sha }}`
154+
155+
let summary = `This check is assosciated with ${shaUrl}\n\n`
156+
157+
if (jobUrl) {
158+
summary += `For run logs, click here: ${jobUrl}`
159+
} else {
160+
summary += `Run logs could not be found for a job with name: "${jobName}"`
161+
}
162+
163+
return { summary }
164+
- name: Create Check
165+
uses: LouisBrunner/[email protected]
166+
id: check
167+
if: inputs.check-sha
168+
with:
169+
token: ${{ secrets.GITHUB_TOKEN }}
170+
status: in_progress
171+
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
172+
sha: ${{ inputs.check-sha }}
173+
output: ${{ steps.check-output.outputs.result }}
174+
- name: Checkout
175+
uses: actions/checkout@v3
176+
with:
177+
ref: ${{ inputs.ref }}
178+
- name: Setup Git User
179+
run: |
180+
git config --global user.email "[email protected]"
181+
git config --global user.name "npm CLI robot"
182+
- name: Setup Node
183+
uses: actions/setup-node@v3
184+
with:
185+
node-version: ${{ matrix.node-version }}
186+
- name: Update Windows npm
187+
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
188+
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
189+
run: |
190+
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
191+
tar xf npm-7.5.4.tgz
192+
cd package
193+
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
194+
cd ..
195+
rmdir /s /q package
196+
- name: Install npm@7
197+
if: startsWith(matrix.node-version, '10.')
198+
run: npm i --prefer-online --no-fund --no-audit -g npm@7
199+
- name: Install npm@latest
200+
if: ${{ !startsWith(matrix.node-version, '10.') }}
201+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
202+
- name: npm Version
203+
run: npm -v
204+
- name: Install Dependencies
205+
run: npm i --ignore-scripts --no-audit --no-fund
206+
- name: Add Problem Matcher
207+
run: echo "::add-matcher::.github/matchers/tap.json"
208+
- name: Test
209+
run: npm test --ignore-scripts
210+
- name: Conclude Check
211+
uses: LouisBrunner/[email protected]
212+
if: steps.check.outputs.check_id && always()
213+
with:
214+
token: ${{ secrets.GITHUB_TOKEN }}
215+
conclusion: ${{ job.status }}
216+
check_id: ${{ steps.check.outputs.check_id }}

0 commit comments

Comments
 (0)