From 8f550eecf134521618b5dee785ce217a840e74fc Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Fri, 3 May 2024 11:39:43 -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 e5e0dcc..f36c8ad 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.4", + "@npmcli/template-oss": "4.22.0", "tap": "^16.0.0" }, "engines": { From 559c6e67730413ba4ea9ec9af40239831e5a5bce Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Fri, 3 May 2024 11:39:48 -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 770f62b..6547a10 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,19 +80,36 @@ jobs: - name: macOS os: macos-latest shell: bash + - name: macOS + os: macos-13 + shell: bash node-version: - 16.14.0 - 16.x - 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 @@ -108,7 +125,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 2c5ba8e..e922815 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,25 +57,42 @@ jobs: - name: macOS os: macos-latest shell: bash + - name: macOS + os: macos-13 + shell: bash node-version: - 16.14.0 - 16.x - 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 f36c8ad..8421b8a 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/cacache.git" + "url": "git+https://github.com/npm/cacache.git" }, "keywords": [ "cache", @@ -69,7 +69,7 @@ "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", "windowsCI": false, - "version": "4.21.4", + "version": "4.22.0", "publish": "true" }, "author": "GitHub Inc.", 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 2dd8bc3e2cf366e3d4ef762657fe98f6f30dd691 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Fri, 3 May 2024 14:15:15 -0700 Subject: [PATCH 3/3] fix(linting): no-unused-vars --- lib/content/read.js | 2 +- lib/content/write.js | 2 +- lib/entry-index.js | 2 +- lib/verify.js | 6 +++--- test/content/read.js | 6 +++--- test/entry-index.js | 6 +++--- test/rm.js | 2 +- test/verify.js | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/content/read.js b/lib/content/read.js index a1fa8a0..5f6192c 100644 --- a/lib/content/read.js +++ b/lib/content/read.js @@ -71,7 +71,7 @@ function readStream (cache, integrity, opts = {}) { module.exports.copy = copy function copy (cache, integrity, dest) { - return withContentSri(cache, integrity, (cpath, sri) => { + return withContentSri(cache, integrity, (cpath) => { return fs.copyFile(cpath, dest) }) } diff --git a/lib/content/write.js b/lib/content/write.js index 09ca4e4..e7187ab 100644 --- a/lib/content/write.js +++ b/lib/content/write.js @@ -160,7 +160,7 @@ async function makeTmp (cache, opts) { } } -async function moveToDestination (tmp, cache, sri, opts) { +async function moveToDestination (tmp, cache, sri) { const destination = contentPath(cache, sri) const destDir = path.dirname(destination) if (moveOperations.has(destination)) { diff --git a/lib/entry-index.js b/lib/entry-index.js index 722a37a..5bc2189 100644 --- a/lib/entry-index.js +++ b/lib/entry-index.js @@ -240,7 +240,7 @@ async function bucketEntries (bucket, filter) { return _bucketEntries(data, filter) } -function _bucketEntries (data, filter) { +function _bucketEntries (data) { const entries = [] data.split('\n').forEach((entry) => { if (!entry) { diff --git a/lib/verify.js b/lib/verify.js index 62e85c9..d7423da 100644 --- a/lib/verify.js +++ b/lib/verify.js @@ -68,11 +68,11 @@ async function verify (cache, opts) { return stats } -async function markStartTime (cache, opts) { +async function markStartTime () { return { startTime: new Date() } } -async function markEndTime (cache, opts) { +async function markEndTime () { return { endTime: new Date() } } @@ -213,7 +213,7 @@ async function rebuildIndex (cache, opts) { return stats } -async function rebuildBucket (cache, bucket, stats, opts) { +async function rebuildBucket (cache, bucket, stats) { await truncate(bucket._path) // This needs to be serialized because cacache explicitly // lets very racy bucket conflicts clobber each other. diff --git a/test/content/read.js b/test/content/read.js index 7ba83f2..5b103f0 100644 --- a/test/content/read.js +++ b/test/content/read.js @@ -26,7 +26,7 @@ const getReadStatFailure = (t, err) => getRead(t, { }, 'fs/promises': { ...fs.promises, - stat: async (path) => { + stat: async () => { throw err }, }, @@ -153,7 +153,7 @@ t.test('read: error while parsing provided integrity data', function (t) { const INTEGRITY = 'sha1-deadbeef' const mockedRead = getRead(t, { ssri: { - parse (sri) { + parse () { throw genericError }, }, @@ -221,7 +221,7 @@ t.test('read: opening large files', function (t) { const mockedRead = getRead(t, { 'fs/promises': { ...fs.promises, - stat: async (path) => { + stat: async () => { return { size: Number.MAX_SAFE_INTEGER } }, }, diff --git a/test/entry-index.js b/test/entry-index.js index 744b2ea..07a5fab 100644 --- a/test/entry-index.js +++ b/test/entry-index.js @@ -19,7 +19,7 @@ const getEntryIndex = (t, opts) => t.mock('../lib/entry-index', opts) const getEntryIndexReadFileFailure = (t, err) => getEntryIndex(t, { 'fs/promises': { ...fs.promises, - readFile: async (path, encode) => { + readFile: async () => { throw err }, }, @@ -177,7 +177,7 @@ t.test('find: error on parsing json data', (t) => { // mocks readFile in order to return a borked json payload const { find } = getEntryIndex(t, { '@npmcli/fs': Object.assign({}, require('@npmcli/fs'), { - readFile: async (path, encode) => { + readFile: async () => { return '\ncec8d2e4685534ed189b563c8ee1cb1cb7c72874\t{"""// foo' }, }), @@ -235,7 +235,7 @@ t.test('lsStream: unknown error reading dirs', (t) => { const { lsStream } = getEntryIndex(t, { 'fs/promises': { ...fs.promises, - readdir: async (path) => { + readdir: async () => { throw genericError }, }, diff --git a/test/rm.js b/test/rm.js index 783bf83..0593ea0 100644 --- a/test/rm.js +++ b/test/rm.js @@ -50,7 +50,7 @@ t.test('rm.content removes content, not entries', (t) => { .then(() => { return get(cache, KEY) }) - .then((res) => { + .then(() => { throw new Error('unexpected success') }) .catch((err) => { diff --git a/test/verify.js b/test/verify.js index a3f8333..72627e3 100644 --- a/test/verify.js +++ b/test/verify.js @@ -217,7 +217,7 @@ t.test('missing file error when validating cache content', async t => { missingFileError.code = 'ENOENT' const mockVerify = getVerify(t, { 'fs/promises': Object.assign({}, fs, { - stat: async (path) => { + stat: async () => { throw missingFileError }, }), @@ -239,7 +239,7 @@ t.test('missing file error when validating cache content', async t => { t.test('unknown error when validating content', async t => { const mockVerify = getVerify(t, { 'fs/promises': Object.assign({}, fs, { - stat: async (path) => { + stat: async () => { throw genericError }, }),