Skip to content

Commit

Permalink
fix(rebuild): don't run lifecycle scripts twice on linked deps (#4529)
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Mar 10, 2022
1 parent ad4b564 commit fbdb431
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions workspaces/arborist/lib/arborist/rebuild.js
Expand Up @@ -136,27 +136,26 @@ 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]) {
await this[_linkAllBins]()
}
}

if (!this[_ignoreScripts]) {
await this[_runScripts]('install')
await this[_runScripts]('postinstall')
}

process.emit('timeEnd', `build:${type}`)
}

Expand Down

0 comments on commit fbdb431

Please sign in to comment.