From 99d88454248f950b82652b592fe2b4d019c1060b Mon Sep 17 00:00:00 2001 From: nlf Date: Wed, 23 Mar 2022 08:23:56 -0700 Subject: [PATCH] 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 --- workspaces/arborist/lib/arborist/load-virtual.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/workspaces/arborist/lib/arborist/load-virtual.js b/workspaces/arborist/lib/arborist/load-virtual.js index 4d65e3da6f683..8a41e7686e7e1 100644 --- a/workspaces/arborist/lib/arborist/load-virtual.js +++ b/workspaces/arborist/lib/arborist/load-virtual.js @@ -79,7 +79,7 @@ module.exports = cls => class VirtualLoader extends cls { async [loadRoot] (s) { const pj = this.path + '/package.json' const pkg = await rpj(pj).catch(() => s.data.packages['']) || {} - return this[loadWorkspaces](this[loadNode]('', pkg)) + return this[loadWorkspaces](this[loadNode]('', pkg, true)) } async [loadFromShrinkwrap] (s, root) { @@ -264,7 +264,7 @@ module.exports = cls => class VirtualLoader extends cls { } } - [loadNode] (location, sw) { + [loadNode] (location, sw, loadOverrides) { const p = this.virtualTree ? this.virtualTree.realpath : this.path const path = resolve(p, location) // shrinkwrap doesn't include package name unless necessary @@ -290,6 +290,7 @@ module.exports = cls => class VirtualLoader extends cls { optional, devOptional, peer, + loadOverrides, }) // cast to boolean because they're undefined in the lock file when false node.extraneous = !!sw.extraneous