Skip to content

Commit 99d8845

Browse files
nlflukekarrys
authored andcommitted
fix: make sure we loadOverrides on the root node in loadVirtual()
by loading the overrides on the root of the virtual tree, we effectively ensure that `npm ci` will throw an error when your package.json overrides are not in sync with the tree in your package-lock.json
1 parent bd96ae4 commit 99d8845

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

workspaces/arborist/lib/arborist/load-virtual.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ module.exports = cls => class VirtualLoader extends cls {
7979
async [loadRoot] (s) {
8080
const pj = this.path + '/package.json'
8181
const pkg = await rpj(pj).catch(() => s.data.packages['']) || {}
82-
return this[loadWorkspaces](this[loadNode]('', pkg))
82+
return this[loadWorkspaces](this[loadNode]('', pkg, true))
8383
}
8484

8585
async [loadFromShrinkwrap] (s, root) {
@@ -264,7 +264,7 @@ module.exports = cls => class VirtualLoader extends cls {
264264
}
265265
}
266266

267-
[loadNode] (location, sw) {
267+
[loadNode] (location, sw, loadOverrides) {
268268
const p = this.virtualTree ? this.virtualTree.realpath : this.path
269269
const path = resolve(p, location)
270270
// shrinkwrap doesn't include package name unless necessary
@@ -290,6 +290,7 @@ module.exports = cls => class VirtualLoader extends cls {
290290
optional,
291291
devOptional,
292292
peer,
293+
loadOverrides,
293294
})
294295
// cast to boolean because they're undefined in the lock file when false
295296
node.extraneous = !!sw.extraneous

0 commit comments

Comments
 (0)