Skip to content

Commit abf97b2

Browse files
committed
feat: @npmcli/[email protected]
BREAKING CHANGE: `json-parse-even-better-errors` now supports the following semver range for node: `^14.17.0 || ^16.13.0 || >=18.0.0`
1 parent 74c9a7e commit abf97b2

27 files changed

+987
-3532
lines changed

.commitlintrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* This file is automatically added by @npmcli/template-oss. Do not edit. */
2+
3+
module.exports = {
4+
extends: ['@commitlint/config-conventional'],
5+
rules: {
6+
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'deps', 'chore']],
7+
'header-max-length': [2, 'always', 80],
8+
'subject-case': [0, 'always', ['lower-case', 'sentence-case', 'start-case']],
9+
},
10+
}

.eslintrc.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* This file is automatically added by @npmcli/template-oss. Do not edit. */
2+
3+
'use strict'
4+
5+
const { readdirSync: readdir } = require('fs')
6+
7+
const localConfigs = readdir(__dirname)
8+
.filter((file) => file.startsWith('.eslintrc.local.'))
9+
.map((file) => `./${file}`)
10+
11+
module.exports = {
12+
root: true,
13+
extends: [
14+
'@npmcli',
15+
...localConfigs,
16+
],
17+
}

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
* @npm/cli-team

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
name: Bug
4+
description: File a bug/issue
5+
title: "[BUG] <title>"
6+
labels: [ Bug, Needs Triage ]
7+
8+
body:
9+
- type: checkboxes
10+
attributes:
11+
label: Is there an existing issue for this?
12+
description: Please [search here](./issues) to see if an issue already exists for your problem.
13+
options:
14+
- label: I have searched the existing issues
15+
required: true
16+
- type: textarea
17+
attributes:
18+
label: Current Behavior
19+
description: A clear & concise description of what you're experiencing.
20+
validations:
21+
required: false
22+
- type: textarea
23+
attributes:
24+
label: Expected Behavior
25+
description: A clear & concise description of what you expected to happen.
26+
validations:
27+
required: false
28+
- type: textarea
29+
attributes:
30+
label: Steps To Reproduce
31+
description: Steps to reproduce the behavior.
32+
value: |
33+
1. In this environment...
34+
2. With this config...
35+
3. Run '...'
36+
4. See error...
37+
validations:
38+
required: false
39+
- type: textarea
40+
attributes:
41+
label: Environment
42+
description: |
43+
examples:
44+
- **npm**: 7.6.3
45+
- **Node**: 13.14.0
46+
- **OS**: Ubuntu 20.04
47+
- **platform**: Macbook Pro
48+
value: |
49+
- npm:
50+
- Node:
51+
- OS:
52+
- platform:
53+
validations:
54+
required: false

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
blank_issues_enabled: true

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
version: 2
4+
5+
updates:
6+
- package-ecosystem: npm
7+
directory: /
8+
schedule:
9+
interval: daily
10+
allow:
11+
- dependency-type: direct
12+
versioning-strategy: increase-if-necessary
13+
commit-message:
14+
prefix: deps
15+
prefix-development: chore
16+
labels:
17+
- "Dependencies"

.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: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
name: Audit
4+
5+
on:
6+
workflow_dispatch:
7+
schedule:
8+
# "At 08:00 UTC (01:00 PT) on Monday" https://crontab.guru/#0_8_*_*_1
9+
- cron: "0 8 * * 1"
10+
11+
jobs:
12+
audit:
13+
name: Audit Dependencies
14+
if: github.repository_owner == 'npm'
15+
runs-on: ubuntu-latest
16+
defaults:
17+
run:
18+
shell: bash
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
- name: Setup Git User
23+
run: |
24+
git config --global user.email "[email protected]"
25+
git config --global user.name "npm CLI robot"
26+
- name: Setup Node
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: 18.x
30+
- name: Install npm@latest
31+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
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 }}

0 commit comments

Comments
 (0)