Skip to content

Commit f25562d

Browse files
committed
refactor: Use Arborist's inventory to get the target node
1 parent 7f47889 commit f25562d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

internal/shrinkwrap-extractor/lib/convertPackageLockToShrinkwrap.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ export default async function convertPackageLockToShrinkwrap(workspaceRootDir, t
4848
path: workspaceRootDir,
4949
});
5050
const tree = await arb.loadVirtual();
51-
const tops = Array.from(tree.tops.values());
52-
const targetNode = tops.find((node) => node.packageName === targetPackageName);
51+
const targetNode = tree.inventory.get(`node_modules/${targetPackageName}`);
5352
if (!targetNode) {
5453
throw new Error(`Target package "${targetPackageName}" not found in workspace`);
5554
}

0 commit comments

Comments
 (0)