Skip to content

Commit e55cde8

Browse files
committed
chore(deps): @npmcli/template-oss@4.22.0
1 parent f8cc313 commit e55cde8

File tree

14 files changed

+361
-411
lines changed

14 files changed

+361
-411
lines changed

.commitlintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module.exports = {
55
rules: {
66
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'deps', 'chore']],
77
'header-max-length': [2, 'always', 80],
8-
'subject-case': [0, 'always', ['lower-case', 'sentence-case', 'start-case']],
8+
'subject-case': [0],
9+
'body-max-line-length': [0],
910
},
1011
}
Lines changed: 52 additions & 0 deletions
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@v7
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 }}"}
Lines changed: 58 additions & 0 deletions
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/settings.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ branches:
1515
protection:
1616
required_status_checks: null
1717
enforce_admins: true
18+
block_creations: true
1819
required_pull_request_reviews:
1920
required_approving_review_count: 1
2021
require_code_owner_reviews: true
@@ -24,10 +25,11 @@ branches:
2425
apps: []
2526
users: []
2627
teams: [ "cli-team" ]
27-
- name: latest
28+
- name: release/v5
2829
protection:
2930
required_status_checks: null
3031
enforce_admins: true
32+
block_creations: true
3133
required_pull_request_reviews:
3234
required_approving_review_count: 1
3335
require_code_owner_reviews: true
@@ -37,10 +39,11 @@ branches:
3739
apps: []
3840
users: []
3941
teams: [ "cli-team" ]
40-
- name: release/v*
42+
- name: release/v6
4143
protection:
4244
required_status_checks: null
4345
enforce_admins: true
46+
block_creations: true
4447
required_pull_request_reviews:
4548
required_approving_review_count: 1
4649
require_code_owner_reviews: true

.github/workflows/audit.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,17 @@ jobs:
1818
shell: bash
1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
2222
- name: Setup Git User
2323
run: |
2424
git config --global user.email "npm-cli+bot@github.com"
2525
git config --global user.name "npm CLI robot"
2626
- name: Setup Node
27-
uses: actions/setup-node@v3
27+
uses: actions/setup-node@v4
28+
id: node
2829
with:
29-
node-version: 18.x
30-
- name: Remove Template-OSS
31-
if: matrix && matrix.node-version == '6.17.1'
32-
run: |
33-
# template-oss cannot be installed on older npms because there are transient deps
34-
# that use "npm:" aliases which are not supported
35-
jq 'del(.devDependencies["@npmcli/template-oss"])' package.json > package.json-update
36-
mv package.json-update package.json
30+
node-version: 22.x
31+
check-latest: contains('22.x', '.x')
3732
- name: Install Dependencies
3833
run: npm i --ignore-scripts --no-audit --no-fund --package-lock
3934
- name: Run Production Audit

.github/workflows/ci-release.yml

Lines changed: 30 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -27,68 +27,28 @@ 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
74-
uses: actions/checkout@v3
31+
uses: actions/checkout@v4
7532
with:
7633
ref: ${{ inputs.ref }}
7734
- name: Setup Git User
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
82-
uses: actions/setup-node@v3
47+
uses: actions/setup-node@v4
48+
id: node
8349
with:
84-
node-version: 18.x
85-
- name: Remove Template-OSS
86-
if: matrix && matrix.node-version == '6.17.1'
87-
run: |
88-
# template-oss cannot be installed on older npms because there are transient deps
89-
# that use "npm:" aliases which are not supported
90-
jq 'del(.devDependencies["@npmcli/template-oss"])' package.json > package.json-update
91-
mv package.json-update package.json
50+
node-version: 22.x
51+
check-latest: contains('22.x', '.x')
9252
- name: Install Dependencies
9353
run: npm i --ignore-scripts --no-audit --no-fund
9454
- name: Lint
@@ -97,11 +57,11 @@ jobs:
9757
run: npm run postlint --ignore-scripts
9858
- name: Conclude Check
9959
uses: LouisBrunner/checks-action@v1.6.0
100-
if: steps.check.outputs.check_id && always()
60+
if: always()
10161
with:
10262
token: ${{ secrets.GITHUB_TOKEN }}
10363
conclusion: ${{ job.status }}
104-
check_id: ${{ steps.check.outputs.check_id }}
64+
check_id: ${{ steps.create-check.outputs.check-id }}
10565

10666
test-all:
10767
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
@@ -115,74 +75,34 @@ jobs:
11575
shell: bash
11676
node-version:
11777
- 6.17.1
118-
- 18.x
78+
- 22.x
11979
runs-on: ${{ matrix.platform.os }}
12080
defaults:
12181
run:
12282
shell: ${{ matrix.platform.shell }}
12383
steps:
124-
- name: Get Workflow Job
125-
uses: actions/github-script@v6
126-
if: inputs.check-sha
127-
id: check-output
128-
env:
129-
JOB_NAME: "Test All"
130-
MATRIX_NAME: " - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
131-
with:
132-
script: |
133-
const { owner, repo } = context.repo
134-
135-
const { data } = await github.rest.actions.listJobsForWorkflowRun({
136-
owner,
137-
repo,
138-
run_id: context.runId,
139-
per_page: 100
140-
})
141-
142-
const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME
143-
const job = data.jobs.find(j => j.name.endsWith(jobName))
144-
const jobUrl = job?.html_url
145-
146-
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ inputs.check-sha }}`
147-
148-
let summary = `This check is assosciated with ${shaUrl}\n\n`
149-
150-
if (jobUrl) {
151-
summary += `For run logs, click here: ${jobUrl}`
152-
} else {
153-
summary += `Run logs could not be found for a job with name: "${jobName}"`
154-
}
155-
156-
return { summary }
157-
- name: Create Check
158-
uses: LouisBrunner/checks-action@v1.6.0
159-
id: check
160-
if: inputs.check-sha
161-
with:
162-
token: ${{ secrets.GITHUB_TOKEN }}
163-
status: in_progress
164-
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
165-
sha: ${{ inputs.check-sha }}
166-
output: ${{ steps.check-output.outputs.result }}
16784
- name: Checkout
168-
uses: actions/checkout@v3
85+
uses: actions/checkout@v4
16986
with:
17087
ref: ${{ inputs.ref }}
17188
- name: Setup Git User
17289
run: |
17390
git config --global user.email "npm-cli+bot@github.com"
17491
git config --global user.name "npm CLI robot"
92+
- name: Create Check
93+
id: create-check
94+
if: ${{ inputs.check-sha }}
95+
uses: ./.github/actions/create-check
96+
with:
97+
name: "Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
98+
token: ${{ secrets.GITHUB_TOKEN }}
99+
sha: ${{ inputs.check-sha }}
175100
- name: Setup Node
176-
uses: actions/setup-node@v3
101+
uses: actions/setup-node@v4
102+
id: node
177103
with:
178104
node-version: ${{ matrix.node-version }}
179-
- name: Remove Template-OSS
180-
if: matrix && matrix.node-version == '6.17.1'
181-
run: |
182-
# template-oss cannot be installed on older npms because there are transient deps
183-
# that use "npm:" aliases which are not supported
184-
jq 'del(.devDependencies["@npmcli/template-oss"])' package.json > package.json-update
185-
mv package.json-update package.json
105+
check-latest: contains(matrix.node-version, '.x')
186106
- name: Install Dependencies
187107
run: npm i --ignore-scripts --no-audit --no-fund
188108
- name: Add Problem Matcher
@@ -191,8 +111,8 @@ jobs:
191111
run: npm test --ignore-scripts
192112
- name: Conclude Check
193113
uses: LouisBrunner/checks-action@v1.6.0
194-
if: steps.check.outputs.check_id && always()
114+
if: always()
195115
with:
196116
token: ${{ secrets.GITHUB_TOKEN }}
197117
conclusion: ${{ job.status }}
198-
check_id: ${{ steps.check.outputs.check_id }}
118+
check_id: ${{ steps.create-check.outputs.check-id }}

0 commit comments

Comments
 (0)