Skip to content

Commit

Permalink
fix: clear non-exist workspace part in package-lock.json when npm ins…
Browse files Browse the repository at this point in the history
…tall (fix npm#5463)
  • Loading branch information
ivan committed Sep 7, 2022
1 parent eb1998a commit 7795a7c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions workspaces/arborist/lib/shrinkwrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,18 @@ class Shrinkwrap {
if (node === this.tree || node.isRoot || node.location === '') {
continue
}

const loc = relpath(this.path, node.path)

// extraneous ws node should not commit
if(node.extraneous) {
const wsIndex = root.workspaces.findIndex(ws => ws === loc)
if(wsIndex > -1) {
root.workspaces.splice(wsIndex, 1)
continue
}
}

this.data.packages[loc] = Shrinkwrap.metaFromNode(
node,
this.path,
Expand Down

0 comments on commit 7795a7c

Please sign in to comment.