Skip to content

Commit

Permalink
feat!: adds --ignore-scripts flag to pack
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `--ignore-scripts` now applies to all lifecycle scripts, include `prepare`
  • Loading branch information
reggi committed Oct 17, 2024
2 parents f7f3087 + f143eed commit 4a2e481
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 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
2 changes: 1 addition & 1 deletion package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -16885,7 +16885,7 @@
"@npmcli/fs": "^4.0.0",
"@npmcli/installed-package-contents": "^3.0.0",
"@npmcli/map-workspaces": "^4.0.1",
"@npmcli/metavuln-calculator": "^8.0.0",
"@npmcli/metavuln-calculator": "^8.0.1",
"@npmcli/name-from-folder": "^3.0.0",
"@npmcli/node-gyp": "^4.0.0",
"@npmcli/package-json": "^6.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 @@ -3680,7 +3680,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 @@ -3694,6 +3694,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
4 changes: 3 additions & 1 deletion workspaces/arborist/lib/arborist/rebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ module.exports = cls => class Builder extends cls {

// links should run prepare scripts and only link bins after that
if (type === 'links') {
await this.#runScripts('prepare')
if (!this.options.ignoreScripts) {
await this.#runScripts('prepare')
}
}
if (this.options.binLinks) {
await this.#linkAllBins()
Expand Down
2 changes: 1 addition & 1 deletion workspaces/arborist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@npmcli/fs": "^4.0.0",
"@npmcli/installed-package-contents": "^3.0.0",
"@npmcli/map-workspaces": "^4.0.1",
"@npmcli/metavuln-calculator": "^8.0.0",
"@npmcli/metavuln-calculator": "^8.0.1",
"@npmcli/name-from-folder": "^3.0.0",
"@npmcli/node-gyp": "^4.0.0",
"@npmcli/package-json": "^6.0.1",
Expand Down

0 comments on commit 4a2e481

Please sign in to comment.