Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2022-03-10 21:00:02 +0300
committerGitHub <noreply@github.com>2022-03-10 21:00:02 +0300
commitfbdb43138ab8e682efb7668767465e7066d43b9f (patch)
treeaed4f5272dc731415e9f17435aeaf9bb5bd46c59 /workspaces/arborist/lib
parentad4b564148eaa6fdfe68e5b68f910e41e4e8ee14 (diff)
fix(rebuild): don't run lifecycle scripts twice on linked deps (#4529)
Diffstat (limited to 'workspaces/arborist/lib')
-rw-r--r--workspaces/arborist/lib/arborist/rebuild.js27
1 files changed, 13 insertions, 14 deletions
diff --git a/workspaces/arborist/lib/arborist/rebuild.js b/workspaces/arborist/lib/arborist/rebuild.js
index 09b4419f5..8b4790400 100644
--- a/workspaces/arborist/lib/arborist/rebuild.js
+++ b/workspaces/arborist/lib/arborist/rebuild.js
@@ -136,15 +136,19 @@ module.exports = cls => class Builder extends cls {
process.emit('time', `build:${type}`)
await this[_buildQueues](nodes)
- if (!this[_ignoreScripts]) {
- await this[_runScripts]('preinstall')
- }
- if (this[_binLinks] && type !== 'links') {
- await this[_linkAllBins]()
- }
-
- // links should also run prepare scripts and only link bins after that
- if (type === 'links') {
+ // links should run prepare scripts and only link bins after that
+ if (type !== 'links') {
+ if (!this[_ignoreScripts]) {
+ await this[_runScripts]('preinstall')
+ }
+ if (this[_binLinks]) {
+ await this[_linkAllBins]()
+ }
+ if (!this[_ignoreScripts]) {
+ await this[_runScripts]('install')
+ await this[_runScripts]('postinstall')
+ }
+ } else {
await this[_runScripts]('prepare')
if (this[_binLinks]) {
@@ -152,11 +156,6 @@ module.exports = cls => class Builder extends cls {
}
}
- if (!this[_ignoreScripts]) {
- await this[_runScripts]('install')
- await this[_runScripts]('postinstall')
- }
-
process.emit('timeEnd', `build:${type}`)
}