Skip to content

Commit 6ed3535

Browse files
authored
fix: linked-strategy lifecycle missing bins (#6175)
1 parent ec8c95c commit 6ed3535

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

workspaces/arborist/lib/arborist/rebuild.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ module.exports = cls => class Builder extends cls {
8989
const {
9090
depNodes,
9191
linkNodes,
92-
storeNodes,
9392
} = this[_retrieveNodesByType](nodes)
9493

9594
// build regular deps
@@ -100,10 +99,6 @@ module.exports = cls => class Builder extends cls {
10099
this[_resetQueues]()
101100
await this[_build](linkNodes, { type: 'links' })
102101
}
103-
if (storeNodes.size) {
104-
this[_resetQueues]()
105-
await this[_build](storeNodes, { type: 'storelinks' })
106-
}
107102

108103
process.emit('timeEnd', 'build')
109104
}
@@ -146,6 +141,12 @@ module.exports = cls => class Builder extends cls {
146141
depNodes.add(node)
147142
}
148143
}
144+
// Make sure that store linked nodes are processed last.
145+
// We can't process store links separately or else lifecycle scripts on
146+
// standard nodes might not have bin links yet.
147+
for (const node of storeNodes) {
148+
depNodes.add(node)
149+
}
149150

150151
// deduplicates link nodes and their targets, avoids
151152
// calling lifecycle scripts twice when running `npm rebuild`
@@ -162,7 +163,6 @@ module.exports = cls => class Builder extends cls {
162163
return {
163164
depNodes,
164165
linkNodes,
165-
storeNodes,
166166
}
167167
}
168168

@@ -330,10 +330,12 @@ module.exports = cls => class Builder extends cls {
330330
devOptional,
331331
package: pkg,
332332
location,
333+
isStoreLink,
333334
} = node.target
334335

335336
// skip any that we know we'll be deleting
336-
if (this[_trashList].has(path)) {
337+
// or storeLinks
338+
if (this[_trashList].has(path) || isStoreLink) {
337339
return
338340
}
339341

0 commit comments

Comments
 (0)