Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: npm/template-oss
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: bbea5f99f572591cb5a487903703f238b7dc07aa
Choose a base ref
...
head repository: npm/template-oss
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 844092742836cd09d9ac50bf5e8e1b2425b50711
Choose a head ref
Loading
Showing with 11,068 additions and 1,805 deletions.
  1. +3 −0 .eslintrc.js
  2. +0 −6 .eslintrc.local.js
  3. +6 −0 .eslintrc.local.json
  4. +1 −1 .github/dependabot.yml
  5. +32 −0 .github/matchers/tap.json
  6. +0 −2 .github/settings.yml
  7. +22 −12 .github/workflows/audit.yml
  8. +210 −0 .github/workflows/ci-release.yml
  9. +107 −36 .github/workflows/ci.yml
  10. +11 −17 .github/workflows/codeql-analysis.yml
  11. +100 −22 .github/workflows/post-dependabot.yml
  12. +28 −18 .github/workflows/pull-request.yml
  13. +0 −26 .github/workflows/release-please.yml
  14. +298 −0 .github/workflows/release.yml
  15. +13 −10 .gitignore
  16. +3 −0 .release-please-manifest.json
  17. +313 −0 CHANGELOG.md
  18. +7 −0 CODE_OF_CONDUCT.md
  19. +260 −0 bin/release-manager.js
  20. +68 −0 bin/release-please.js
  21. +4 −4 lib/apply/apply-files.js
  22. +26 −0 lib/apply/apply-version.js
  23. +2 −1 lib/apply/index.js
  24. +5 −4 lib/check/check-apply.js
  25. +6 −6 lib/check/check-changelog.js
  26. +4 −4 lib/check/check-gitignore.js
  27. +1 −1 lib/check/index.js
  28. +210 −108 lib/config.js
  29. +5 −0 lib/content/CODE_OF_CONDUCT.md
  30. +29 −0 lib/content/_job-matrix.yml
  31. +8 −0 lib/content/_job.yml
  32. +30 −0 lib/content/_on-ci.yml
  33. +2 −0 lib/content/_step-audit.yml
  34. +54 −0 lib/content/_step-checks.yml
  35. +2 −0 lib/content/_step-deps.yml
  36. +12 −0 lib/content/_step-git.yml
  37. +4 −0 lib/content/_step-lint.yml
  38. +15 −9 lib/content/{setup-node.yml → _step-node.yml}
  39. +4 −0 lib/content/_step-test.yml
  40. +6 −0 lib/content/_steps-setup.yml
  41. +4 −8 lib/content/audit.yml
  42. +31 −0 lib/content/ci-release.yml
  43. +15 −52 lib/content/ci.yml
  44. +12 −19 lib/content/codeql-analysis.yml
  45. +1 −1 lib/content/commitlintrc.js
  46. +2 −2 lib/content/dependabot.yml
  47. +10 −0 lib/content/eslintrc.js
  48. +1 −11 lib/content/gitignore
  49. +84 −8 lib/content/index.js
  50. +1 −1 lib/content/npmrc
  51. +34 −14 lib/content/pkg.json
  52. +87 −19 lib/content/post-dependabot.yml
  53. +11 −14 lib/content/pull-request.yml
  54. +13 −0 lib/content/release-please-config.json
  55. +3 −0 lib/content/release-please-manifest.json
  56. +0 −31 lib/content/release-please.yml
  57. +133 −0 lib/content/release.yml
  58. +0 −11 lib/content/setup-git.yml
  59. +28 −0 lib/content/tap.json
  60. +27 −30 lib/index.js
  61. +83 −0 lib/release-please/changelog.js
  62. +56 −0 lib/release-please/github.js
  63. +97 −0 lib/release-please/index.js
  64. +193 −0 lib/release-please/node-workspace.js
  65. +14 −0 lib/release-please/util.js
  66. +103 −0 lib/release-please/version.js
  67. +74 −15 lib/util/files.js
  68. +3 −1 lib/util/get-git-url.js
  69. +34 −0 lib/util/gitignore.js
  70. +13 −1 lib/util/has-package.js
  71. +21 −0 lib/util/merge.js
  72. +80 −23 lib/util/parser.js
  73. +38 −20 lib/util/template.js
  74. +28 −15 package.json
  75. +36 −0 release-please-config.json
  76. +161 −0 tap-snapshots/test/apply/files-snapshots.js.test.cjs
  77. +1,392 −176 tap-snapshots/test/apply/full-content.js.test.cjs
  78. +0 −49 tap-snapshots/test/apply/index.js.test.cjs
  79. +4,297 −0 tap-snapshots/test/apply/source-snapshots.js.test.cjs
  80. +0 −23 tap-snapshots/test/check/changelog.js.test.cjs
  81. +244 −0 tap-snapshots/test/check/diff-snapshots.js.test.cjs
  82. +0 −429 tap-snapshots/test/check/diffs.js.test.cjs
  83. +0 −214 tap-snapshots/test/check/gitignore.js.test.cjs
  84. +0 −22 tap-snapshots/test/check/required.js.test.cjs
  85. +248 −29 tap-snapshots/test/check/{index.js.test.cjs → snapshots.js.test.cjs}
  86. +0 −20 tap-snapshots/test/check/unwanted.js.test.cjs
  87. +47 −0 test/apply/allow-paths.js
  88. +81 −0 test/apply/engines.js
  89. +178 −0 test/apply/files-snapshots.js
  90. +0 −43 test/apply/full-content.js
  91. +299 −26 test/apply/index.js
  92. +28 −0 test/apply/lockfile.js
  93. +117 −0 test/apply/merge-yml.js
  94. +36 −0 test/apply/npm-bin.js
  95. +27 −0 test/apply/release.js
  96. +75 −0 test/apply/source-snapshots.js
  97. +27 −0 test/apply/version.js
  98. +0 −17 test/check/changelog.js
  99. +36 −46 test/check/{diffs.js → diff-snapshots.js}
  100. +1 −1 test/check/dogfood.js
  101. +5 −51 test/check/gitignore.js
  102. +10 −15 test/check/index.js
  103. +0 −9 test/check/required.js
  104. +77 −0 test/check/snapshots.js
  105. +0 −17 test/check/unwanted.js
  106. +0 −1 test/fixtures/header.js
  107. +13 −0 test/fixtures/yml-merge.js
  108. +16 −11 test/index.js
  109. +98 −0 test/release-please/changelog.js
  110. +178 −0 test/release-please/node-workspace.js
  111. +62 −0 test/release-please/version.js
  112. +29 −22 test/setup.js
  113. +5 −1 test/util/has-package.js
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/* 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,
6 changes: 0 additions & 6 deletions .eslintrc.local.js

This file was deleted.

6 changes: 6 additions & 0 deletions .eslintrc.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ignorePatterns": [
"lib/content/*",
"!lib/content/index.js"
]
}
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ version: 2

updates:
- package-ecosystem: npm
directory: "/"
directory: /
schedule:
interval: daily
allow:
32 changes: 32 additions & 0 deletions .github/matchers/tap.json
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
}
]
}
]
}
2 changes: 0 additions & 2 deletions .github/settings.yml

This file was deleted.

34 changes: 22 additions & 12 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -5,23 +5,33 @@ name: Audit
on:
workflow_dispatch:
schedule:
# "At 01:00 on Monday" https://crontab.guru/#0_1_*_*_1
- cron: "0 1 * * 1"
# "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:
- uses: actions/checkout@v3
- name: Setup git user
- name: Checkout
uses: actions/checkout@v3
- name: Setup Git User
run: |
git config --global user.email "ops+npm-cli@npmjs.com"
git config --global user.name "npm cli ops bot"
- uses: actions/setup-node@v3
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Update npm to latest
node-version: 18.x
- name: Install npm@latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --package-lock
- run: npm audit
- name: npm Version
run: npm -v
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund --package-lock
- name: Run Audit
run: npm audit
210 changes: 210 additions & 0 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

name: CI - Release

on:
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

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/checks-action@v1.3.1
id: check

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 "npm-cli+bot@github.com"
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/checks-action@v1.3.1
if: 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

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/checks-action@v1.3.1
id: check

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 "npm-cli+bot@github.com"
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/checks-action@v1.3.1
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ job.status }}
check_id: ${{ steps.check.outputs.check_id }}
Loading