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
1 parent f4bc573 commit f143eed
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 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: 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

0 comments on commit f143eed

Please sign in to comment.