Skip to content

Commit fbdb431

Browse files
authored
fix(rebuild): don't run lifecycle scripts twice on linked deps (#4529)
1 parent ad4b564 commit fbdb431

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

workspaces/arborist/lib/arborist/rebuild.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,27 +136,26 @@ module.exports = cls => class Builder extends cls {
136136
process.emit('time', `build:${type}`)
137137

138138
await this[_buildQueues](nodes)
139-
if (!this[_ignoreScripts]) {
140-
await this[_runScripts]('preinstall')
141-
}
142-
if (this[_binLinks] && type !== 'links') {
143-
await this[_linkAllBins]()
144-
}
145-
146-
// links should also run prepare scripts and only link bins after that
147-
if (type === 'links') {
139+
// links should run prepare scripts and only link bins after that
140+
if (type !== 'links') {
141+
if (!this[_ignoreScripts]) {
142+
await this[_runScripts]('preinstall')
143+
}
144+
if (this[_binLinks]) {
145+
await this[_linkAllBins]()
146+
}
147+
if (!this[_ignoreScripts]) {
148+
await this[_runScripts]('install')
149+
await this[_runScripts]('postinstall')
150+
}
151+
} else {
148152
await this[_runScripts]('prepare')
149153

150154
if (this[_binLinks]) {
151155
await this[_linkAllBins]()
152156
}
153157
}
154158

155-
if (!this[_ignoreScripts]) {
156-
await this[_runScripts]('install')
157-
await this[_runScripts]('postinstall')
158-
}
159-
160159
process.emit('timeEnd', `build:${type}`)
161160
}
162161

0 commit comments

Comments
 (0)