Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: linked-strategy lifecycle missing bins #6175

Merged
merged 2 commits into from
Feb 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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