Skip to content

Commit f0983ef

Browse files
committed
feat!: postinstall for dependabot template-oss PR
BREAKING CHANGE: `validate-npm-package-name` is now compatible with the following semver range for node: `^14.17.0 || ^16.13.0 || >=18.0.0`
1 parent 5ba262a commit f0983ef

14 files changed

+655
-136
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
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

Lines changed: 32 additions & 0 deletions
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

Lines changed: 20 additions & 10 deletions
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:
22-
node-version: 16.x
23-
- name: Update npm to latest
29+
node-version: 18.x
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

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
name: CI - Release
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
ref:
9+
required: true
10+
type: string
11+
check-sha:
12+
required: true
13+
type: string
14+
15+
jobs:
16+
lint-all:
17+
name: Lint All
18+
if: github.repository_owner == 'npm'
19+
runs-on: ubuntu-latest
20+
defaults:
21+
run:
22+
shell: bash
23+
steps:
24+
- name: Create Check
25+
uses: LouisBrunner/[email protected]
26+
id: check
27+
28+
with:
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
status: in_progress
31+
name: Lint All
32+
sha: ${{ inputs.check-sha }}
33+
# XXX: this does not work when using the default GITHUB_TOKEN.
34+
# Instead we post the main job url to the PR as a comment which
35+
# will link to all the other checks. To work around this we would
36+
# need to create a GitHub that would create on-demand tokens.
37+
# https://github.com/LouisBrunner/checks-action/issues/18
38+
# details_url:
39+
- name: Checkout
40+
uses: actions/checkout@v3
41+
with:
42+
ref: ${{ inputs.ref }}
43+
- name: Setup Git User
44+
run: |
45+
git config --global user.email "[email protected]"
46+
git config --global user.name "npm CLI robot"
47+
- name: Setup Node
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: 18.x
51+
- name: Install npm@latest
52+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
53+
- name: npm Version
54+
run: npm -v
55+
- name: Install Dependencies
56+
run: npm i --ignore-scripts --no-audit --no-fund
57+
- name: Lint
58+
run: npm run lint --ignore-scripts
59+
- name: Post Lint
60+
run: npm run postlint --ignore-scripts
61+
- name: Conclude Check
62+
uses: LouisBrunner/[email protected]
63+
if: always()
64+
with:
65+
token: ${{ secrets.GITHUB_TOKEN }}
66+
conclusion: ${{ job.status }}
67+
check_id: ${{ steps.check.outputs.check_id }}
68+
69+
test-all:
70+
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
71+
if: github.repository_owner == 'npm'
72+
strategy:
73+
fail-fast: false
74+
matrix:
75+
platform:
76+
- name: Linux
77+
os: ubuntu-latest
78+
shell: bash
79+
- name: macOS
80+
os: macos-latest
81+
shell: bash
82+
- name: Windows
83+
os: windows-latest
84+
shell: cmd
85+
node-version:
86+
- 14.17.0
87+
- 14.x
88+
- 16.13.0
89+
- 16.x
90+
- 18.0.0
91+
- 18.x
92+
runs-on: ${{ matrix.platform.os }}
93+
defaults:
94+
run:
95+
shell: ${{ matrix.platform.shell }}
96+
steps:
97+
- name: Create Check
98+
uses: LouisBrunner/[email protected]
99+
id: check
100+
101+
with:
102+
token: ${{ secrets.GITHUB_TOKEN }}
103+
status: in_progress
104+
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
105+
sha: ${{ inputs.check-sha }}
106+
# XXX: this does not work when using the default GITHUB_TOKEN.
107+
# Instead we post the main job url to the PR as a comment which
108+
# will link to all the other checks. To work around this we would
109+
# need to create a GitHub that would create on-demand tokens.
110+
# https://github.com/LouisBrunner/checks-action/issues/18
111+
# details_url:
112+
- name: Checkout
113+
uses: actions/checkout@v3
114+
with:
115+
ref: ${{ inputs.ref }}
116+
- name: Setup Git User
117+
run: |
118+
git config --global user.email "[email protected]"
119+
git config --global user.name "npm CLI robot"
120+
- name: Setup Node
121+
uses: actions/setup-node@v3
122+
with:
123+
node-version: ${{ matrix.node-version }}
124+
- name: Update Windows npm
125+
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
126+
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
127+
run: |
128+
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
129+
tar xf npm-7.5.4.tgz
130+
cd package
131+
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
132+
cd ..
133+
rmdir /s /q package
134+
- name: Install npm@7
135+
if: startsWith(matrix.node-version, '10.')
136+
run: npm i --prefer-online --no-fund --no-audit -g npm@7
137+
- name: Install npm@latest
138+
if: ${{ !startsWith(matrix.node-version, '10.') }}
139+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
140+
- name: npm Version
141+
run: npm -v
142+
- name: Install Dependencies
143+
run: npm i --ignore-scripts --no-audit --no-fund
144+
- name: Add Problem Matcher
145+
run: echo "::add-matcher::.github/matchers/tap.json"
146+
- name: Test
147+
run: npm test --ignore-scripts -ws -iwr --if-present
148+
- name: Conclude Check
149+
uses: LouisBrunner/[email protected]
150+
if: always()
151+
with:
152+
token: ${{ secrets.GITHUB_TOKEN }}
153+
conclusion: ${{ job.status }}
154+
check_id: ${{ steps.check.outputs.check_id }}

.github/workflows/ci.yml

Lines changed: 53 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,66 +5,83 @@ name: CI
55
on:
66
workflow_dispatch:
77
pull_request:
8-
branches:
9-
- '*'
108
push:
119
branches:
1210
- main
1311
- latest
1412
schedule:
15-
# "At 02:00 on Monday" https://crontab.guru/#0_2_*_*_1
16-
- cron: "0 2 * * 1"
13+
# "At 09:00 UTC (02:00 PT) on Monday" https://crontab.guru/#0_9_*_*_1
14+
- cron: "0 9 * * 1"
1715

1816
jobs:
1917
lint:
18+
name: Lint
19+
if: github.repository_owner == 'npm'
2020
runs-on: ubuntu-latest
21+
defaults:
22+
run:
23+
shell: bash
2124
steps:
22-
- uses: actions/checkout@v3
23-
- name: Setup git user
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
- name: Setup Git User
2428
run: |
2529
git config --global user.email "[email protected]"
2630
git config --global user.name "npm CLI robot"
27-
- uses: actions/setup-node@v3
31+
- name: Setup Node
32+
uses: actions/setup-node@v3
2833
with:
29-
node-version: 16.x
30-
- name: Update npm to latest
34+
node-version: 18.x
35+
- name: Install npm@latest
3136
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
32-
- run: npm -v
33-
- run: npm i --ignore-scripts --no-audit --no-fund
34-
- run: npm run lint
37+
- name: npm Version
38+
run: npm -v
39+
- name: Install Dependencies
40+
run: npm i --ignore-scripts --no-audit --no-fund
41+
- name: Lint
42+
run: npm run lint --ignore-scripts
43+
- name: Post Lint
44+
run: npm run postlint --ignore-scripts
3545

3646
test:
47+
name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
48+
if: github.repository_owner == 'npm'
3749
strategy:
3850
fail-fast: false
3951
matrix:
40-
node-version:
41-
- 12.13.0
42-
- 12.x
43-
- 14.15.0
44-
- 14.x
45-
- 16.0.0
46-
- 16.x
4752
platform:
48-
- os: ubuntu-latest
53+
- name: Linux
54+
os: ubuntu-latest
4955
shell: bash
50-
- os: macos-latest
56+
- name: macOS
57+
os: macos-latest
5158
shell: bash
52-
- os: windows-latest
59+
- name: Windows
60+
os: windows-latest
5361
shell: cmd
62+
node-version:
63+
- 14.17.0
64+
- 14.x
65+
- 16.13.0
66+
- 16.x
67+
- 18.0.0
68+
- 18.x
5469
runs-on: ${{ matrix.platform.os }}
5570
defaults:
5671
run:
5772
shell: ${{ matrix.platform.shell }}
5873
steps:
59-
- uses: actions/checkout@v3
60-
- name: Setup git user
74+
- name: Checkout
75+
uses: actions/checkout@v3
76+
- name: Setup Git User
6177
run: |
6278
git config --global user.email "[email protected]"
6379
git config --global user.name "npm CLI robot"
64-
- uses: actions/setup-node@v3
80+
- name: Setup Node
81+
uses: actions/setup-node@v3
6582
with:
6683
node-version: ${{ matrix.node-version }}
67-
- name: Update to workable npm (windows)
84+
- name: Update Windows npm
6885
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
6986
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
7087
run: |
@@ -74,13 +91,17 @@ jobs:
7491
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
7592
cd ..
7693
rmdir /s /q package
77-
- name: Update npm to 7
78-
# If we do test on npm 10 it needs npm7
94+
- name: Install npm@7
7995
if: startsWith(matrix.node-version, '10.')
8096
run: npm i --prefer-online --no-fund --no-audit -g npm@7
81-
- name: Update npm to latest
97+
- name: Install npm@latest
8298
if: ${{ !startsWith(matrix.node-version, '10.') }}
8399
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
84-
- run: npm -v
85-
- run: npm i --ignore-scripts --no-audit --no-fund
86-
- run: npm test --ignore-scripts
100+
- name: npm Version
101+
run: npm -v
102+
- name: Install Dependencies
103+
run: npm i --ignore-scripts --no-audit --no-fund
104+
- name: Add Problem Matcher
105+
run: echo "::add-matcher::.github/matchers/tap.json"
106+
- name: Test
107+
run: npm test --ignore-scripts -iwr

0 commit comments

Comments
 (0)