Skip to content

Commit

Permalink
fix: fixed linked installs lifecycle batching order, no lifecycle scr…
Browse files Browse the repository at this point in the history
…ipts on store links
  • Loading branch information
fritzy committed Feb 16, 2023
1 parent a60b34e commit ead9ce8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions workspaces/arborist/lib/arborist/rebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ module.exports = cls => class Builder extends cls {
const {
depNodes,
linkNodes,
storeNodes,
} = this[_retrieveNodesByType](nodes)

// build regular deps
Expand All @@ -100,10 +99,6 @@ module.exports = cls => class Builder extends cls {
this[_resetQueues]()
await this[_build](linkNodes, { type: 'links' })
}
if (storeNodes.size) {
this[_resetQueues]()
await this[_build](storeNodes, { type: 'storelinks' })
}

process.emit('timeEnd', 'build')
}
Expand Down Expand Up @@ -146,6 +141,9 @@ module.exports = cls => class Builder extends cls {
depNodes.add(node)
}
}
for (const node of storeNodes) {
depNodes.add(node)
}

// deduplicates link nodes and their targets, avoids
// calling lifecycle scripts twice when running `npm rebuild`
Expand All @@ -162,7 +160,6 @@ module.exports = cls => class Builder extends cls {
return {
depNodes,
linkNodes,
storeNodes,
}
}

Expand Down Expand Up @@ -330,10 +327,12 @@ module.exports = cls => class Builder extends cls {
devOptional,
package: pkg,
location,
isStoreLink,
} = node.target

// skip any that we know we'll be deleting
if (this[_trashList].has(path)) {
// or storeLinks
if (this[_trashList].has(path) || isStoreLink) {
return
}

Expand Down

0 comments on commit ead9ce8

Please sign in to comment.