+41
-2
lines changedFilter options
+41
-2
lines changed Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ class Pack extends BaseCommand {
15
15
'workspace',
16
16
'workspaces',
17
17
'include-workspace-root',
18
+
'ignore-scripts',
18
19
]
19
20
20
21
static usage = ['<package-spec>']
Original file line number Diff line number Diff line change
@@ -3680,7 +3680,7 @@ npm pack <package-spec>
3680
3680
Options:
3681
3681
[--dry-run] [--json] [--pack-destination <pack-destination>]
3682
3682
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
3683
-
[-ws|--workspaces] [--include-workspace-root]
3683
+
[-ws|--workspaces] [--include-workspace-root] [--ignore-scripts]
3684
3684
3685
3685
Run "npm help pack" for more info
3686
3686
@@ -3694,6 +3694,7 @@ npm pack <package-spec>
3694
3694
#### \`workspace\`
3695
3695
#### \`workspaces\`
3696
3696
#### \`include-workspace-root\`
3697
+
#### \`ignore-scripts\`
3697
3698
`
3698
3699
3699
3700
exports[`test/lib/docs.js TAP usage ping > must match snapshot 1`] = `
Original file line number Diff line number Diff line change
@@ -154,7 +154,9 @@ module.exports = cls => class Builder extends cls {
154
154
155
155
// links should run prepare scripts and only link bins after that
156
156
if (type === 'links') {
157
-
await this.#runScripts('prepare')
157
+
if (!this.options.ignoreScripts) {
158
+
await this.#runScripts('prepare')
159
+
}
158
160
}
159
161
if (this.options.binLinks) {
160
162
await this.#linkAllBins()
Original file line number Diff line number Diff line change
@@ -812,3 +812,38 @@ t.test('no workspaces', async t => {
812
812
},
813
813
])
814
814
})
815
+
816
+
t.test('do not run lifecycle scripts of linked deps twice', async t => {
817
+
const testdir = t.testdir({
818
+
project: {
819
+
'package.json': JSON.stringify({
820
+
name: 'my-project',
821
+
version: '1.0.0',
822
+
dependencies: {
823
+
foo: 'file:../foo',
824
+
},
825
+
}),
826
+
node_modules: {
827
+
foo: t.fixture('symlink', '../../foo'),
828
+
},
829
+
},
830
+
foo: {
831
+
'package.json': JSON.stringify({
832
+
name: 'foo',
833
+
version: '1.0.0',
834
+
scripts: {
835
+
postinstall: 'echo "ok"',
836
+
},
837
+
}),
838
+
},
839
+
})
840
+
841
+
const path = resolve(testdir, 'project')
842
+
const Arborist = t.mock('../../lib/arborist/index.js', {
843
+
'@npmcli/run-script': () => {
844
+
throw new Error('should not run any scripts')
845
+
},
846
+
})
847
+
const arb = new Arborist({ path, ignoreScripts: true })
848
+
await arb.rebuild()
849
+
})
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4