Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion lib/commands/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,28 @@ class CI extends ArboristWorkspaceCmd {
return Promise.all(entries.map(f => rimraf(`${path}/${f}`, { glob: false })))
})

const ignoreScripts = this.npm.config.get('ignore-scripts')
// run the same set of scripts that `npm install` runs.
if (!ignoreScripts) {
const scripts = [
'prefetch',
]
const scriptShell = this.npm.config.get('script-shell') || undefined
for (const event of scripts) {
await runScript({
path: where,
args: [],
scriptShell,
stdio: 'inherit',
stdioString: true,
banner: !this.npm.silent,
event,
})
}
}

await arb.reify(opts)

const ignoreScripts = this.npm.config.get('ignore-scripts')
// run the same set of scripts that `npm install` runs.
if (!ignoreScripts) {
const scripts = [
Expand Down
17 changes: 17 additions & 0 deletions lib/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,23 @@ class Install extends ArboristWorkspaceCmd {
throw this.usageError()
}

if (!args.length && !isGlobalInstall && !ignoreScripts) {
const scripts = [
'prefetch',
]
for (const event of scripts) {
await runScript({
path: where,
args: [],
scriptShell,
stdio: 'inherit',
stdioString: true,
banner: !this.npm.silent,
event,
})
}
}

const opts = {
...this.npm.flatOptions,
auditLevel: null,
Expand Down
1 change: 1 addition & 0 deletions test/lib/commands/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ t.test('lifecycle scripts', async t => {
registry.nock.post('/-/npm/v1/security/advisories/bulk').reply(200, {})
await npm.exec('ci', [])
t.same(scripts, [
'prefetch',
'preinstall',
'install',
'postinstall',
Expand Down
1 change: 1 addition & 0 deletions test/lib/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ t.test('without args', async t => {
t.match(ARB_ARGS, { global: false, path: npm.prefix })
t.equal(REIFY_CALLED, true, 'called reify')
t.strictSame(SCRIPTS, [
'prefetch',
'preinstall',
'install',
'postinstall',
Expand Down