From 2c7aaceab3e3ad67a28ad365b10b10f347994eab Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Fri, 3 May 2024 11:41:29 -0700 Subject: [PATCH 1/3] chore: bump @npmcli/template-oss to 4.22.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7491dcc..fe62579 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.4", + "@npmcli/template-oss": "4.22.0", "npm-package-arg": "^11.0.0", "slash": "^3.0.0", "tap": "^16.0.1" From a274bd9ee9c205a7ec4af3f7b0d9f3e0e106f355 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Fri, 3 May 2024 11:41:34 -0700 Subject: [PATCH 2/3] chore: postinstall for dependabot template-oss PR --- .github/actions/create-check/action.yml | 2 +- .github/workflows/audit.yml | 8 +++---- .github/workflows/ci-release.yml | 29 ++++++++++++++++++----- .github/workflows/ci.yml | 29 ++++++++++++++++++----- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/post-dependabot.yml | 8 +++---- .github/workflows/pull-request.yml | 8 +++---- .github/workflows/release-integration.yml | 19 +++++---------- .github/workflows/release.yml | 22 ++++++++--------- package.json | 4 ++-- release-please-config.json | 15 ++++-------- 11 files changed, 84 insertions(+), 62 deletions(-) diff --git a/.github/actions/create-check/action.yml b/.github/actions/create-check/action.yml index 0e7d6ce..aa24a5b 100644 --- a/.github/actions/create-check/action.yml +++ b/.github/actions/create-check/action.yml @@ -17,7 +17,7 @@ runs: using: "composite" steps: - name: Get Workflow Job - uses: actions/github-script@v6 + uses: actions/github-script@v7 id: workflow env: JOB_NAME: "${{ inputs.name }}" diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index fa3163a..a3ae725 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -18,17 +18,17 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - 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 + uses: actions/setup-node@v4 id: node with: - node-version: 20.x - check-latest: contains('20.x', '.x') + node-version: 22.x + check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index f507d25..0c952cb 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -28,7 +28,7 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - name: Setup Git User @@ -44,11 +44,11 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} sha: ${{ inputs.check-sha }} - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 id: node with: - node-version: 20.x - check-latest: contains('20.x', '.x') + node-version: 22.x + check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: @@ -80,6 +80,9 @@ jobs: - name: macOS os: macos-latest shell: bash + - name: macOS + os: macos-13 + shell: bash - name: Windows os: windows-latest shell: cmd @@ -89,13 +92,27 @@ jobs: - 18.0.0 - 18.x - 20.x + - 22.x + exclude: + - platform: { name: macOS, os: macos-13, shell: bash } + node-version: 16.14.0 + - platform: { name: macOS, os: macos-13, shell: bash } + node-version: 16.x + - platform: { name: macOS, os: macos-13, shell: bash } + node-version: 18.0.0 + - platform: { name: macOS, os: macos-13, shell: bash } + node-version: 18.x + - platform: { name: macOS, os: macos-13, shell: bash } + node-version: 20.x + - platform: { name: macOS, os: macos-13, shell: bash } + node-version: 22.x runs-on: ${{ matrix.platform.os }} defaults: run: shell: ${{ matrix.platform.shell }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - name: Setup Git User @@ -111,7 +128,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} sha: ${{ inputs.check-sha }} - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 id: node with: node-version: ${{ matrix.node-version }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35c5dc3..7915009 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,17 +22,17 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - 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 + uses: actions/setup-node@v4 id: node with: - node-version: 20.x - check-latest: contains('20.x', '.x') + node-version: 22.x + check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: @@ -57,6 +57,9 @@ jobs: - name: macOS os: macos-latest shell: bash + - name: macOS + os: macos-13 + shell: bash - name: Windows os: windows-latest shell: cmd @@ -66,19 +69,33 @@ jobs: - 18.0.0 - 18.x - 20.x + - 22.x + exclude: + - platform: { name: macOS, os: macos-13, shell: bash } + node-version: 16.14.0 + - platform: { name: macOS, os: macos-13, shell: bash } + node-version: 16.x + - platform: { name: macOS, os: macos-13, shell: bash } + node-version: 18.0.0 + - platform: { name: macOS, os: macos-13, shell: bash } + node-version: 18.x + - platform: { name: macOS, os: macos-13, shell: bash } + node-version: 20.x + - platform: { name: macOS, os: macos-13, shell: bash } + node-version: 22.x runs-on: ${{ matrix.platform.os }} defaults: run: shell: ${{ matrix.platform.shell }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - 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 + uses: actions/setup-node@v4 id: node with: node-version: ${{ matrix.node-version }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f7e691d..13efe1b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -23,7 +23,7 @@ jobs: security-events: write steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Git User run: | git config --global user.email "npm-cli+bot@github.com" diff --git a/.github/workflows/post-dependabot.yml b/.github/workflows/post-dependabot.yml index 11a7b7c..a7ebe12 100644 --- a/.github/workflows/post-dependabot.yml +++ b/.github/workflows/post-dependabot.yml @@ -17,7 +17,7 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.ref }} - name: Setup Git User @@ -25,11 +25,11 @@ jobs: 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 + uses: actions/setup-node@v4 id: node with: - node-version: 20.x - check-latest: contains('20.x', '.x') + node-version: 22.x + check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 0b5789e..7dbdfd4 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -20,7 +20,7 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Git User @@ -28,11 +28,11 @@ jobs: 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 + uses: actions/setup-node@v4 id: node with: - node-version: 20.x - check-latest: contains('20.x', '.x') + node-version: 22.x + check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: diff --git a/.github/workflows/release-integration.yml b/.github/workflows/release-integration.yml index d986e4b..130578e 100644 --- a/.github/workflows/release-integration.yml +++ b/.github/workflows/release-integration.yml @@ -30,7 +30,7 @@ jobs: id-token: write steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ fromJSON(inputs.releases)[0].tagName }} - name: Setup Git User @@ -38,11 +38,11 @@ jobs: 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 + uses: actions/setup-node@v4 id: node with: - node-version: 20.x - check-latest: contains('20.x', '.x') + node-version: 22.x + check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: @@ -58,17 +58,10 @@ jobs: run: | EXIT_CODE=0 - function each_release { - if npm publish --provenance --tag="$1"; then - echo 0 - else - echo 1 - fi - } - for release in $(echo $RELEASES | jq -r '.[] | @base64'); do PUBLISH_TAG=$(echo "$release" | base64 --decode | jq -r .publishTag) - STATUS=$(each_release "$PUBLISH_TAG") + npm publish --provenance --tag="$PUBLISH_TAG" + STATUS=$? if [[ "$STATUS" -eq 1 ]]; then EXIT_CODE=$STATUS fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a05c444..75acebb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,17 +30,17 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - 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 + uses: actions/setup-node@v4 id: node with: - node-version: 20.x - check-latest: contains('20.x', '.x') + node-version: 22.x + check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: @@ -54,7 +54,7 @@ jobs: run: npx --offline template-oss-release-please --branch="${{ github.ref_name }}" --backport="" --defaultTag="latest" - name: Create Release Manager Comment Text if: steps.release.outputs.pr-number - uses: actions/github-script@v6 + uses: actions/github-script@v7 id: comment-text with: result-encoding: string @@ -107,7 +107,7 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ needs.release.outputs.pr-branch }} @@ -116,11 +116,11 @@ jobs: 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 + uses: actions/setup-node@v4 id: node with: - node-version: 20.x - check-latest: contains('20.x', '.x') + node-version: 22.x + check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: @@ -215,7 +215,7 @@ jobs: steps: - name: Create Release PR Comment Text id: comment-text - uses: actions/github-script@v6 + uses: actions/github-script@v7 env: RELEASES: ${{ needs.release.outputs.releases }} with: @@ -280,7 +280,7 @@ jobs: - name: Create Release PR Comment Text id: comment-text if: steps.found-comment.outputs.comment-id - uses: actions/github-script@v6 + uses: actions/github-script@v7 env: RESULT: ${{ steps.conclusion.outputs.result }} BODY: ${{ steps.found-comment.outputs.comment-body }} diff --git a/package.json b/package.json index fe62579..d6d8f56 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "description": "a util for spawning git from npm CLI contexts", "repository": { "type": "git", - "url": "https://github.com/npm/git.git" + "url": "git+https://github.com/npm/git.git" }, "author": "GitHub Inc.", "license": "ISC", @@ -51,7 +51,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.4", + "version": "4.22.0", "publish": true } } diff --git a/release-please-config.json b/release-please-config.json index 559ef7d..a1676b9 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -5,32 +5,27 @@ { "type": "feat", "section": "Features", - "hidden": false, - "collapse": false + "hidden": false }, { "type": "fix", "section": "Bug Fixes", - "hidden": false, - "collapse": false + "hidden": false }, { "type": "docs", "section": "Documentation", - "hidden": false, - "collapse": false + "hidden": false }, { "type": "deps", "section": "Dependencies", - "hidden": false, - "collapse": false + "hidden": false }, { "type": "chore", "section": "Chores", - "hidden": false, - "collapse": false + "hidden": true } ], "packages": { From 840485f7ca723972d3c33166b625e665ea19aafe Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Fri, 3 May 2024 14:18:22 -0700 Subject: [PATCH 3/3] fix(linting): no-unused-vars --- lib/errors.js | 6 +++--- test/clone.js | 6 +++--- test/is-clean.js | 2 +- test/revs.js | 4 ++-- test/spawn.js | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/errors.js b/lib/errors.js index 7aeac47..3ceaa45 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -8,7 +8,7 @@ class GitError extends Error { } class GitConnectionError extends GitError { - constructor (message) { + constructor () { super('A git connection error occurred') } @@ -18,13 +18,13 @@ class GitConnectionError extends GitError { } class GitPathspecError extends GitError { - constructor (message) { + constructor () { super('The git reference could not be found') } } class GitUnknownError extends GitError { - constructor (message) { + constructor () { super('An unknown git error occurred') } } diff --git a/test/clone.js b/test/clone.js index 6d802a9..988e727 100644 --- a/test/clone.js +++ b/test/clone.js @@ -28,7 +28,7 @@ let repoSha = '' let submodsRepoSha = '' t.setTimeout(120000) -t.test('create repo', { bail: true }, t => { +t.test('create repo', { bail: true }, () => { const git = (...cmd) => spawnGit(cmd, { cwd: repo }) const write = (f, c) => fs.writeFileSync(`${repo}/${f}`, c) return git('init', '-b', 'main') @@ -100,7 +100,7 @@ t.test('spawn daemon', { bail: true }, t => { daemon.on('close', () => fs.rmSync(me, { recursive: true, force: true })) }) -t.test('create a repo with a submodule', { bail: true }, t => { +t.test('create a repo with a submodule', { bail: true }, () => { const submoduleRepo = resolve(me, 'submodule-repo') const git = (...cmd) => spawnGit(cmd, { cwd: submoduleRepo }) const write = (f, c) => fs.writeFileSync(`${submoduleRepo}/${f}`, c) @@ -226,7 +226,7 @@ const clonedRepo = join(me, clonedRepoDir) const clonedRepoSpaces = join(me, clonedSpacesRepoDir) const clonedRepoSpaces2 = join(me, clonedSpacesRepoDir2) -t.test('setup aditional tests', t => { +t.test('setup aditional tests', () => { const git = (...cmd) => spawnGit(cmd, { cwd: regularRepo }) const write = (f, c) => fs.writeFileSync(`${regularRepo}/${f}`, c) return git('init', '-b', 'main') diff --git a/test/is-clean.js b/test/is-clean.js index a7e875e..491487d 100644 --- a/test/is-clean.js +++ b/test/is-clean.js @@ -8,7 +8,7 @@ const { promisify } = require('util') const writeFile = promisify(require('fs').writeFile) const write = (file, data) => writeFile(resolve(repo, file), data) -t.test('create git repo', t => +t.test('create git repo', () => spawn(['init'], { cwd: repo }) .then(() => spawn(['config', 'user.name', 'pacotedev'], { cwd: repo })) .then(() => spawn(['config', 'user.email', 'i+pacotedev@izs.me'], { cwd: repo })) diff --git a/test/revs.js b/test/revs.js index 4e14e6e..ba6e5da 100644 --- a/test/revs.js +++ b/test/revs.js @@ -25,7 +25,7 @@ const fixMainBranch = (err) => { return git('init') } const write = (f, c) => fs.writeFileSync(`${repo}/${f}`, c) -t.test('setup', t => +t.test('setup', () => git('init', '-b', mainBranch).catch(fixMainBranch) .then(() => git('config', 'user.name', 'pacotedev')) .then(() => git('config', 'user.email', 'i+pacotedev@izs.me')) @@ -57,7 +57,7 @@ t.test('point latest at HEAD', t => latest: '69.42.0', }))) -t.test('add a latest branch, point to 1.2.3 version', t => +t.test('add a latest branch, point to 1.2.3 version', () => git('checkout', '-b', 'latest') .then(() => git('reset', '--hard', 'version-1.2.3')) .then(() => git('checkout', mainBranch)) diff --git a/test/spawn.js b/test/spawn.js index da09581..b68fbc6 100644 --- a/test/spawn.js +++ b/test/spawn.js @@ -27,7 +27,7 @@ t.test('argument test for allowReplace', async t => { // for our purposes. This just tests that the argument is added // by default. const mockedSpawn = t.mock('../lib/spawn.js', { - '@npmcli/promise-spawn': async (exe, args, opts) => args, + '@npmcli/promise-spawn': async (exe, args) => args, }) const [allow, deny, allowWithArg, denyWithArg] = await Promise.all([ mockedSpawn(['a', 'b', 'c'], { allowReplace: true }),