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: d942e77e3479685bbe5d42936f5fd12592610233
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: 7f86c5fbe81c50ab35d954f891332bab00568c18
Choose a head ref
Loading
Showing with 3,640 additions and 1,097 deletions.
  1. +1 −0 .eslintrc.js
  2. +0 −6 .eslintrc.local.json
  3. +1 −12 .github/dependabot.yml
  4. +27 −0 .github/settings.yml
  5. +32 −3 .github/workflows/audit.yml
  6. +78 −20 .github/workflows/ci-release.yml
  7. +74 −17 .github/workflows/ci-test-workspace.yml
  8. +74 −17 .github/workflows/ci.yml
  9. +0 −2 .github/workflows/codeql-analysis.yml
  10. +32 −3 .github/workflows/post-dependabot.yml
  11. +35 −4 .github/workflows/pull-request.yml
  12. +70 −14 .github/workflows/release.yml
  13. +4 −0 .gitignore
  14. +1 −1 .release-please-manifest.json
  15. +104 −0 CHANGELOG.md
  16. +50 −0 CONTRIBUTING.md
  17. +15 −11 README.md
  18. +7 −1 bin/release-manager.js
  19. +1 −1 lib/apply/apply-files.js
  20. +2 −1 lib/check/check-apply.js
  21. +127 −125 lib/config.js
  22. 0 lib/content/{CODEOWNERS → CODEOWNERS.hbs}
  23. 0 lib/content/{CODE_OF_CONDUCT.md → CODE_OF_CONDUCT-md.hbs}
  24. +48 −0 lib/content/CONTRIBUTING-md.hbs
  25. 0 lib/content/{LICENSE.md → LICENSE-md.hbs}
  26. 0 lib/content/{SECURITY.md → SECURITY-md.hbs}
  27. +1 −1 lib/content/{_job-matrix.yml → _job-matrix-yml.hbs}
  28. +2 −2 lib/content/{_job-release-integration.yml → _job-release-integration-yml.hbs}
  29. +1 −1 lib/content/{_job.yml → _job-yml.hbs}
  30. +1 −1 lib/content/{_on-ci.yml → _on-ci-yml.hbs}
  31. 0 lib/content/{_step-audit.yml → _step-audit-yml.hbs}
  32. +1 −1 lib/content/{_step-checks.yml → _step-checks-yml.hbs}
  33. 0 lib/content/{_step-deps.yml → _step-deps-yml.hbs}
  34. 0 lib/content/{_step-git.yml → _step-git-yml.hbs}
  35. 0 lib/content/{_step-lint.yml → _step-lint-yml.hbs}
  36. +60 −0 lib/content/_step-node-yml.hbs
  37. +0 −31 lib/content/_step-node.yml
  38. 0 lib/content/{_step-test.yml → _step-test-yml.hbs}
  39. +6 −0 lib/content/_steps-setup-yml.hbs
  40. +0 −6 lib/content/_steps-setup.yml
  41. +2 −2 lib/content/{audit.yml → audit-yml.hbs}
  42. 0 lib/content/{bug.yml → bug-yml.hbs}
  43. +7 −7 lib/content/{ci-release.yml → ci-release-yml.hbs}
  44. +13 −0 lib/content/ci-yml.hbs
  45. +0 −13 lib/content/ci.yml
  46. +3 −3 lib/content/{codeql-analysis.yml → codeql-analysis-yml.hbs}
  47. 0 lib/content/{commitlintrc.js → commitlintrc-js.hbs}
  48. 0 lib/content/{config.yml → config-yml.hbs}
  49. +24 −0 lib/content/dependabot-yml.hbs
  50. +0 −15 lib/content/dependabot.yml
  51. +11 −1 lib/content/{eslintrc.js → eslintrc-js.hbs}
  52. +2 −0 lib/content/{gitignore → gitignore.hbs}
  53. +62 −48 lib/content/index.js
  54. 0 lib/content/{npmrc → npmrc.hbs}
  55. +8 −9 lib/content/{pkg.json → package-json.hbs}
  56. +1 −1 lib/content/{post-dependabot.yml → post-dependabot-yml.hbs}
  57. +4 −2 lib/content/{pull-request.yml → pull-request-yml.hbs}
  58. 0 lib/content/{release-please-config.json → release-please-config-json.hbs}
  59. 0 lib/content/{release-please-manifest.json → release-please-manifest-json.hbs}
  60. +12 −13 lib/content/{release.yml → release-yml.hbs}
  61. +27 −0 lib/content/settings-yml.hbs
  62. 0 lib/content/{tap.json → tap-json.hbs}
  63. +17 −0 lib/content/tsconfig-json.hbs
  64. +80 −0 lib/util/ci-versions.js
  65. +27 −0 lib/util/dependabot.js
  66. +81 −36 lib/util/files.js
  67. +36 −0 lib/util/get-cmd-path.js
  68. +0 −26 lib/util/get-git-url.js
  69. +77 −0 lib/util/git.js
  70. +29 −0 lib/util/import-or-require.js
  71. +62 −12 lib/util/merge.js
  72. +0 −78 lib/util/parse-ci-versions.js
  73. +36 −17 lib/util/parser.js
  74. +13 −0 lib/util/path.js
  75. +9 −6 lib/util/template.js
  76. +11 −10 package.json
  77. +9 −0 tap-snapshots/test/apply/files-snapshots.js.test.cjs
  78. +1,535 −273 tap-snapshots/test/apply/source-snapshots.js.test.cjs
  79. +53 −26 tap-snapshots/test/check/diff-snapshots.js.test.cjs
  80. +18 −16 tap-snapshots/test/check/snapshots.js.test.cjs
  81. +2 −2 test/apply/allow-paths.js
  82. +102 −0 test/apply/dependabot.js
  83. +78 −30 test/apply/engines.js
  84. +24 −0 test/apply/eslint.js
  85. +23 −0 test/apply/esm.js
  86. +35 −37 test/apply/index.js
  87. +15 −67 test/apply/merge-yml.js
  88. +25 −8 test/apply/npm-bin.js
  89. +40 −0 test/apply/overwrite-false.js
  90. +1 −2 test/apply/release-config.js
  91. +35 −7 test/apply/release.js
  92. +37 −0 test/apply/tap.js
  93. +57 −0 test/apply/typescript.js
  94. +7 −5 test/bin/apply.js
  95. +5 −3 test/bin/check.js
  96. +1 −1 test/check/engines.js
  97. +8 −0 test/fixtures/yml-merge.js
  98. +14 −8 test/setup.js
  99. +0 −30 test/util/parse-ci-versions.js
  100. +3 −0 workspace/test-workspace/.eslintrc.js
  101. +2 −0 workspace/test-workspace/.gitignore
  102. +2 −2 workspace/test-workspace/package.json
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ const localConfigs = readdir(__dirname)
module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
'workspace/test-workspace/**',
],
extends: [
6 changes: 0 additions & 6 deletions .eslintrc.local.json

This file was deleted.

13 changes: 1 addition & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -7,18 +7,7 @@ updates:
directory: /
schedule:
interval: daily
allow:
- dependency-type: direct
versioning-strategy: increase-if-necessary
commit-message:
prefix: deps
prefix-development: chore
labels:
- "Dependencies"
- package-ecosystem: npm
directory: workspace/test-workspace/
schedule:
interval: daily
target-branch: "main"
allow:
- dependency-type: direct
versioning-strategy: increase-if-necessary
27 changes: 27 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

repository:
allow_merge_commit: false
allow_rebase_merge: true
allow_squash_merge: true
squash_merge_commit_title: PR_TITLE
squash_merge_commit_message: PR_BODY
delete_branch_on_merge: true
enable_automated_security_fixes: true
enable_vulnerability_alerts: true

branches:
- name: main
protection:
required_status_checks: null
enforce_admins: true
block_creations: true
required_pull_request_reviews:
required_approving_review_count: 1
require_code_owner_reviews: true
require_last_push_approval: true
dismiss_stale_reviews: true
restrictions:
apps: []
users: []
teams: [ "cli-team" ]
35 changes: 32 additions & 3 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -25,10 +25,39 @@ jobs:
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v3
id: node
with:
node-version: 18.x
- name: Install npm@latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
node-version: 20.x
check-latest: contains('20.x', '.x')

- name: Install Latest npm
shell: bash
env:
NODE_VERSION: ${{ steps.node.outputs.node-version }}
run: |
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
echo "node@$NODE_VERSION"
for SPEC in ${SPECS[@]}; do
ENGINES=$(npm view npm@$SPEC --json | jq -r '.engines.node')
echo "Checking if node@$NODE_VERSION satisfies npm@$SPEC ($ENGINES)"
if npx semver -r "$ENGINES" "$NODE_VERSION" > /dev/null; then
MATCH=$SPEC
echo "Found compatible version: npm@$MATCH"
break
fi
done
if [ -z $MATCH ]; then
echo "Could not find a compatible version of npm for node@$NODE_VERSION"
exit 1
fi
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
- name: npm Version
run: npm -v
- name: Install Dependencies
98 changes: 78 additions & 20 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ jobs:
return { summary }
- name: Create Check
uses: LouisBrunner/checks-action@v1.3.1
uses: LouisBrunner/checks-action@v1.6.0
id: check
if: inputs.check-sha
with:
@@ -80,10 +80,39 @@ jobs:
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v3
id: node
with:
node-version: 18.x
- name: Install npm@latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
node-version: 20.x
check-latest: contains('20.x', '.x')

- name: Install Latest npm
shell: bash
env:
NODE_VERSION: ${{ steps.node.outputs.node-version }}
run: |
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
echo "node@$NODE_VERSION"
for SPEC in ${SPECS[@]}; do
ENGINES=$(npm view npm@$SPEC --json | jq -r '.engines.node')
echo "Checking if node@$NODE_VERSION satisfies npm@$SPEC ($ENGINES)"
if npx semver -r "$ENGINES" "$NODE_VERSION" > /dev/null; then
MATCH=$SPEC
echo "Found compatible version: npm@$MATCH"
break
fi
done
if [ -z $MATCH ]; then
echo "Could not find a compatible version of npm for node@$NODE_VERSION"
exit 1
fi
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
- name: npm Version
run: npm -v
- name: Install Dependencies
@@ -93,7 +122,7 @@ jobs:
- name: Post Lint
run: npm run postlint --ignore-scripts -ws -iwr --if-present
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
uses: LouisBrunner/checks-action@v1.6.0
if: steps.check.outputs.check_id && always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
@@ -117,12 +146,10 @@ jobs:
os: windows-latest
shell: cmd
node-version:
- 14.17.0
- 14.x
- 16.13.0
- 16.x
- 18.0.0
- 18.17.0
- 18.x
- 20.5.0
- 20.x
runs-on: ${{ matrix.platform.os }}
defaults:
run:
@@ -162,7 +189,7 @@ jobs:
return { summary }
- name: Create Check
uses: LouisBrunner/checks-action@v1.3.1
uses: LouisBrunner/checks-action@v1.6.0
id: check
if: inputs.check-sha
with:
@@ -181,24 +208,55 @@ jobs:
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v3
id: node
with:
node-version: ${{ matrix.node-version }}
check-latest: contains(matrix.node-version, '.x')

# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
- 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.'))
if: |
matrix.platform.os == 'windows-latest' && (
startsWith(steps.node.outputs.node-version, 'v10.') ||
startsWith(steps.node.outputs.node-version, 'v12.') ||
startsWith(steps.node.outputs.node-version, 'v14.')
)
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: Install Latest npm
shell: bash
env:
NODE_VERSION: ${{ steps.node.outputs.node-version }}
run: |
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
echo "node@$NODE_VERSION"
for SPEC in ${SPECS[@]}; do
ENGINES=$(npm view npm@$SPEC --json | jq -r '.engines.node')
echo "Checking if node@$NODE_VERSION satisfies npm@$SPEC ($ENGINES)"
if npx semver -r "$ENGINES" "$NODE_VERSION" > /dev/null; then
MATCH=$SPEC
echo "Found compatible version: npm@$MATCH"
break
fi
done
if [ -z $MATCH ]; then
echo "Could not find a compatible version of npm for node@$NODE_VERSION"
exit 1
fi
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
- name: npm Version
run: npm -v
- name: Install Dependencies
@@ -208,7 +266,7 @@ jobs:
- name: Test
run: npm test --ignore-scripts -ws -iwr --if-present
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
uses: LouisBrunner/checks-action@v1.6.0
if: steps.check.outputs.check_id && always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
91 changes: 74 additions & 17 deletions .github/workflows/ci-test-workspace.yml
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ on:
push:
branches:
- main
- latest
paths:
- workspace/test-workspace/**
schedule:
@@ -34,10 +33,39 @@ jobs:
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v3
id: node
with:
node-version: 18.x
- name: Install npm@latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
node-version: 20.x
check-latest: contains('20.x', '.x')

- name: Install Latest npm
shell: bash
env:
NODE_VERSION: ${{ steps.node.outputs.node-version }}
run: |
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
echo "node@$NODE_VERSION"
for SPEC in ${SPECS[@]}; do
ENGINES=$(npm view npm@$SPEC --json | jq -r '.engines.node')
echo "Checking if node@$NODE_VERSION satisfies npm@$SPEC ($ENGINES)"
if npx semver -r "$ENGINES" "$NODE_VERSION" > /dev/null; then
MATCH=$SPEC
echo "Found compatible version: npm@$MATCH"
break
fi
done
if [ -z $MATCH ]; then
echo "Could not find a compatible version of npm for node@$NODE_VERSION"
exit 1
fi
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
- name: npm Version
run: npm -v
- name: Install Dependencies
@@ -64,12 +92,10 @@ jobs:
os: windows-latest
shell: cmd
node-version:
- 14.17.0
- 14.x
- 16.13.0
- 16.x
- 18.0.0
- 18.17.0
- 18.x
- 20.5.0
- 20.x
runs-on: ${{ matrix.platform.os }}
defaults:
run:
@@ -83,24 +109,55 @@ jobs:
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v3
id: node
with:
node-version: ${{ matrix.node-version }}
check-latest: contains(matrix.node-version, '.x')

# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
- 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.'))
if: |
matrix.platform.os == 'windows-latest' && (
startsWith(steps.node.outputs.node-version, 'v10.') ||
startsWith(steps.node.outputs.node-version, 'v12.') ||
startsWith(steps.node.outputs.node-version, 'v14.')
)
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: Install Latest npm
shell: bash
env:
NODE_VERSION: ${{ steps.node.outputs.node-version }}
run: |
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
echo "node@$NODE_VERSION"
for SPEC in ${SPECS[@]}; do
ENGINES=$(npm view npm@$SPEC --json | jq -r '.engines.node')
echo "Checking if node@$NODE_VERSION satisfies npm@$SPEC ($ENGINES)"
if npx semver -r "$ENGINES" "$NODE_VERSION" > /dev/null; then
MATCH=$SPEC
echo "Found compatible version: npm@$MATCH"
break
fi
done
if [ -z $MATCH ]; then
echo "Could not find a compatible version of npm for node@$NODE_VERSION"
exit 1
fi
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
- name: npm Version
run: npm -v
- name: Install Dependencies
Loading