diff --git a/lib/commands/pack.js b/lib/commands/pack.js index 6a1bb53acb8aa..bd190d88d82b6 100644 --- a/lib/commands/pack.js +++ b/lib/commands/pack.js @@ -15,6 +15,7 @@ class Pack extends BaseCommand { 'workspace', 'workspaces', 'include-workspace-root', + 'ignore-scripts', ] static usage = [''] diff --git a/node_modules/pacote/lib/dir.js b/node_modules/pacote/lib/dir.js index 4ae97c216fe64..04846eb8a6e22 100644 --- a/node_modules/pacote/lib/dir.js +++ b/node_modules/pacote/lib/dir.js @@ -32,6 +32,9 @@ class DirFetcher extends Fetcher { if (!mani.scripts || !mani.scripts.prepare) { return } + if (this.opts.ignoreScripts) { + return + } // we *only* run prepare. // pre/post-pack is run by the npm CLI for publish and pack, diff --git a/package-lock.json b/package-lock.json index 3417f532f358f..fd9e19ccb10fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11269,8 +11269,7 @@ }, "node_modules/pacote": { "version": "19.0.1", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-19.0.1.tgz", - "integrity": "sha512-zIpxWAsr/BvhrkSruspG8aqCQUUrWtpwx0GjiRZQhEM/pZXrigA32ElN3vTcCPUDOFmHr6SFxwYrvVUs5NTEUg==", + "resolved": "git+ssh://git@github.com/npm/pacote.git#d8254e94eacf14b7b4c3f99f70e1a0463d9adfeb", "inBundle": true, "license": "ISC", "dependencies": { @@ -17090,7 +17089,7 @@ "@npmcli/arborist": "^8.0.0", "@npmcli/run-script": "^9.0.1", "npm-package-arg": "^12.0.0", - "pacote": "^19.0.0" + "pacote": "github:npm/pacote#reggi/ignore-scripts" }, "devDependencies": { "@npmcli/eslint-config": "^5.0.1", diff --git a/tap-snapshots/test/lib/docs.js.test.cjs b/tap-snapshots/test/lib/docs.js.test.cjs index 81cd5c1f11ba8..6e8ffced7606a 100644 --- a/tap-snapshots/test/lib/docs.js.test.cjs +++ b/tap-snapshots/test/lib/docs.js.test.cjs @@ -3708,7 +3708,7 @@ npm pack Options: [--dry-run] [--json] [--pack-destination ] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] [--include-workspace-root] [--ignore-scripts] Run "npm help pack" for more info @@ -3722,6 +3722,7 @@ npm pack #### \`workspace\` #### \`workspaces\` #### \`include-workspace-root\` +#### \`ignore-scripts\` ` exports[`test/lib/docs.js TAP usage ping > must match snapshot 1`] = ` diff --git a/workspaces/libnpmpack/package.json b/workspaces/libnpmpack/package.json index 90d1cabf2c1d3..b1fe60e0e2071 100644 --- a/workspaces/libnpmpack/package.json +++ b/workspaces/libnpmpack/package.json @@ -40,7 +40,7 @@ "@npmcli/arborist": "^8.0.0", "@npmcli/run-script": "^9.0.1", "npm-package-arg": "^12.0.0", - "pacote": "^19.0.0" + "pacote": "github:npm/pacote#reggi/ignore-scripts" }, "engines": { "node": "^20.17.0 || >=22.9.0"