Skip to content

Commit

Permalink
fix: linked-strategy lifecycle missing bins (#6175)
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzy authored Feb 21, 2023
1 parent ec8c95c commit 6ed3535
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 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,12 @@ module.exports = cls => class Builder extends cls {
depNodes.add(node)
}
}
// Make sure that store linked nodes are processed last.
// We can't process store links separately or else lifecycle scripts on
// standard nodes might not have bin links yet.
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 +163,6 @@ module.exports = cls => class Builder extends cls {
return {
depNodes,
linkNodes,
storeNodes,
}
}

Expand Down Expand Up @@ -330,10 +330,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 6ed3535

Please sign in to comment.