-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: add @npmcli/template-oss and modernize (#86)
BREAKING CHANGE: refactored with the following breaking changes - callback has been removed from the async interface, it is now `Promise` only - `which` is now compatible with the following semver range for node: `^14.17.0 || ^16.13.0 || >=18.0.0 - cli now ignores any arguments after `--`
- Loading branch information
1 parent
82af5fe
commit 8b0187c
Showing
35 changed files
with
1,546 additions
and
551 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* This file is automatically added by @npmcli/template-oss. Do not edit. */ | ||
|
||
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
rules: { | ||
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'deps', 'chore']], | ||
'header-max-length': [2, 'always', 80], | ||
'subject-case': [0, 'always', ['lower-case', 'sentence-case', 'start-case']], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* This file is automatically added by @npmcli/template-oss. Do not edit. */ | ||
|
||
'use strict' | ||
|
||
const { readdirSync: readdir } = require('fs') | ||
|
||
const localConfigs = readdir(__dirname) | ||
.filter((file) => file.startsWith('.eslintrc.local.')) | ||
.map((file) => `./${file}`) | ||
|
||
module.exports = { | ||
root: true, | ||
extends: [ | ||
'@npmcli', | ||
...localConfigs, | ||
], | ||
} |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# This file is automatically added by @npmcli/template-oss. Do not edit. | ||
|
||
* @npm/cli-team |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# This file is automatically added by @npmcli/template-oss. Do not edit. | ||
|
||
name: Bug | ||
description: File a bug/issue | ||
title: "[BUG] <title>" | ||
labels: [ Bug, Needs Triage ] | ||
|
||
body: | ||
- type: checkboxes | ||
attributes: | ||
label: Is there an existing issue for this? | ||
description: Please [search here](./issues) to see if an issue already exists for your problem. | ||
options: | ||
- label: I have searched the existing issues | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Current Behavior | ||
description: A clear & concise description of what you're experiencing. | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Expected Behavior | ||
description: A clear & concise description of what you expected to happen. | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Steps To Reproduce | ||
description: Steps to reproduce the behavior. | ||
value: | | ||
1. In this environment... | ||
2. With this config... | ||
3. Run '...' | ||
4. See error... | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Environment | ||
description: | | ||
examples: | ||
- **npm**: 7.6.3 | ||
- **Node**: 13.14.0 | ||
- **OS**: Ubuntu 20.04 | ||
- **platform**: Macbook Pro | ||
value: | | ||
- npm: | ||
- Node: | ||
- OS: | ||
- platform: | ||
validations: | ||
required: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# This file is automatically added by @npmcli/template-oss. Do not edit. | ||
|
||
blank_issues_enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This file is automatically added by @npmcli/template-oss. Do not edit. | ||
|
||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: npm | ||
directory: / | ||
schedule: | ||
interval: daily | ||
allow: | ||
- dependency-type: direct | ||
versioning-strategy: increase-if-necessary | ||
commit-message: | ||
prefix: deps | ||
prefix-development: chore | ||
labels: | ||
- "Dependencies" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"//@npmcli/template-oss": "This file is automatically added by @npmcli/template-oss. Do not edit.", | ||
"problemMatcher": [ | ||
{ | ||
"owner": "tap", | ||
"pattern": [ | ||
{ | ||
"regexp": "^\\s*not ok \\d+ - (.*)", | ||
"message": 1 | ||
}, | ||
{ | ||
"regexp": "^\\s*---" | ||
}, | ||
{ | ||
"regexp": "^\\s*at:" | ||
}, | ||
{ | ||
"regexp": "^\\s*line:\\s*(\\d+)", | ||
"line": 1 | ||
}, | ||
{ | ||
"regexp": "^\\s*column:\\s*(\\d+)", | ||
"column": 1 | ||
}, | ||
{ | ||
"regexp": "^\\s*file:\\s*(.*)", | ||
"file": 1 | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This file is automatically added by @npmcli/template-oss. Do not edit. | ||
|
||
name: Audit | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# "At 08:00 UTC (01:00 PT) on Monday" https://crontab.guru/#0_8_*_*_1 | ||
- cron: "0 8 * * 1" | ||
|
||
jobs: | ||
audit: | ||
name: Audit Dependencies | ||
if: github.repository_owner == 'npm' | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Git User | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "npm CLI robot" | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
- name: Install npm@latest | ||
run: npm i --prefer-online --no-fund --no-audit -g npm@latest | ||
- name: npm Version | ||
run: npm -v | ||
- name: Install Dependencies | ||
run: npm i --ignore-scripts --no-audit --no-fund --package-lock | ||
- name: Run Production Audit | ||
run: npm audit --omit=dev | ||
- name: Run Full Audit | ||
run: npm audit --audit-level=none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,216 @@ | ||
# This file is automatically added by @npmcli/template-oss. Do not edit. | ||
|
||
name: CI - Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
ref: | ||
required: true | ||
type: string | ||
default: main | ||
workflow_call: | ||
inputs: | ||
ref: | ||
required: true | ||
type: string | ||
check-sha: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
lint-all: | ||
name: Lint All | ||
if: github.repository_owner == 'npm' | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- name: Get Workflow Job | ||
uses: actions/github-script@v6 | ||
if: inputs.check-sha | ||
id: check-output | ||
env: | ||
JOB_NAME: "Lint All" | ||
MATRIX_NAME: "" | ||
with: | ||
script: | | ||
const { owner, repo } = context.repo | ||
const { data } = await github.rest.actions.listJobsForWorkflowRun({ | ||
owner, | ||
repo, | ||
run_id: context.runId, | ||
per_page: 100 | ||
}) | ||
const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME | ||
const job = data.jobs.find(j => j.name.endsWith(jobName)) | ||
const jobUrl = job?.html_url | ||
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ inputs.check-sha }}` | ||
let summary = `This check is assosciated with ${shaUrl}\n\n` | ||
if (jobUrl) { | ||
summary += `For run logs, click here: ${jobUrl}` | ||
} else { | ||
summary += `Run logs could not be found for a job with name: "${jobName}"` | ||
} | ||
return { summary } | ||
- name: Create Check | ||
uses: LouisBrunner/[email protected] | ||
id: check | ||
if: inputs.check-sha | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
status: in_progress | ||
name: Lint All | ||
sha: ${{ inputs.check-sha }} | ||
output: ${{ steps.check-output.outputs.result }} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
- name: Setup Git User | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "npm CLI robot" | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
- name: Install npm@latest | ||
run: npm i --prefer-online --no-fund --no-audit -g npm@latest | ||
- name: npm Version | ||
run: npm -v | ||
- name: Install Dependencies | ||
run: npm i --ignore-scripts --no-audit --no-fund | ||
- name: Lint | ||
run: npm run lint --ignore-scripts | ||
- name: Post Lint | ||
run: npm run postlint --ignore-scripts | ||
- name: Conclude Check | ||
uses: LouisBrunner/[email protected] | ||
if: steps.check.outputs.check_id && always() | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
conclusion: ${{ job.status }} | ||
check_id: ${{ steps.check.outputs.check_id }} | ||
|
||
test-all: | ||
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }} | ||
if: github.repository_owner == 'npm' | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- name: Linux | ||
os: ubuntu-latest | ||
shell: bash | ||
- name: macOS | ||
os: macos-latest | ||
shell: bash | ||
- name: Windows | ||
os: windows-latest | ||
shell: cmd | ||
node-version: | ||
- 14.17.0 | ||
- 14.x | ||
- 16.13.0 | ||
- 16.x | ||
- 18.0.0 | ||
- 18.x | ||
runs-on: ${{ matrix.platform.os }} | ||
defaults: | ||
run: | ||
shell: ${{ matrix.platform.shell }} | ||
steps: | ||
- name: Get Workflow Job | ||
uses: actions/github-script@v6 | ||
if: inputs.check-sha | ||
id: check-output | ||
env: | ||
JOB_NAME: "Test All" | ||
MATRIX_NAME: " - ${{ matrix.platform.name }} - ${{ matrix.node-version }}" | ||
with: | ||
script: | | ||
const { owner, repo } = context.repo | ||
const { data } = await github.rest.actions.listJobsForWorkflowRun({ | ||
owner, | ||
repo, | ||
run_id: context.runId, | ||
per_page: 100 | ||
}) | ||
const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME | ||
const job = data.jobs.find(j => j.name.endsWith(jobName)) | ||
const jobUrl = job?.html_url | ||
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ inputs.check-sha }}` | ||
let summary = `This check is assosciated with ${shaUrl}\n\n` | ||
if (jobUrl) { | ||
summary += `For run logs, click here: ${jobUrl}` | ||
} else { | ||
summary += `Run logs could not be found for a job with name: "${jobName}"` | ||
} | ||
return { summary } | ||
- name: Create Check | ||
uses: LouisBrunner/[email protected] | ||
id: check | ||
if: inputs.check-sha | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
status: in_progress | ||
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }} | ||
sha: ${{ inputs.check-sha }} | ||
output: ${{ steps.check-output.outputs.result }} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
- name: Setup Git User | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "npm CLI robot" | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Update Windows npm | ||
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows | ||
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) | ||
run: | | ||
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz | ||
tar xf npm-7.5.4.tgz | ||
cd package | ||
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz | ||
cd .. | ||
rmdir /s /q package | ||
- name: Install npm@7 | ||
if: startsWith(matrix.node-version, '10.') | ||
run: npm i --prefer-online --no-fund --no-audit -g npm@7 | ||
- name: Install npm@latest | ||
if: ${{ !startsWith(matrix.node-version, '10.') }} | ||
run: npm i --prefer-online --no-fund --no-audit -g npm@latest | ||
- name: npm Version | ||
run: npm -v | ||
- name: Install Dependencies | ||
run: npm i --ignore-scripts --no-audit --no-fund | ||
- name: Add Problem Matcher | ||
run: echo "::add-matcher::.github/matchers/tap.json" | ||
- name: Test | ||
run: npm test --ignore-scripts | ||
- name: Conclude Check | ||
uses: LouisBrunner/[email protected] | ||
if: steps.check.outputs.check_id && always() | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
conclusion: ${{ job.status }} | ||
check_id: ${{ steps.check.outputs.check_id }} |
Oops, something went wrong.