Skip to content

Commit

Permalink
fix!: pack prepare lifecycle script honors --ignore-scripts
Browse files Browse the repository at this point in the history
BREAKING CHANGE: pack prepare lifecycle script honors `--ignore-scripts`
  • Loading branch information
reggi committed Oct 15, 2024
1 parent f75da94 commit c4c5744
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/commands/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Pack extends BaseCommand {
'workspace',
'workspaces',
'include-workspace-root',
'ignore-scripts',
]

static usage = ['<package-spec>']
Expand Down
3 changes: 3 additions & 0 deletions node_modules/pacote/lib/dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 2 additions & 3 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -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://[email protected]/npm/pacote.git#d8254e94eacf14b7b4c3f99f70e1a0463d9adfeb",
"inBundle": true,
"license": "ISC",
"dependencies": {
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion tap-snapshots/test/lib/docs.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3708,7 +3708,7 @@ npm pack <package-spec>
Options:
[--dry-run] [--json] [--pack-destination <pack-destination>]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--ignore-scripts]
Run "npm help pack" for more info
Expand All @@ -3722,6 +3722,7 @@ npm pack <package-spec>
#### \`workspace\`
#### \`workspaces\`
#### \`include-workspace-root\`
#### \`ignore-scripts\`
`

exports[`test/lib/docs.js TAP usage ping > must match snapshot 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion workspaces/libnpmpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c4c5744

Please sign in to comment.