Skip to content

Commit

Permalink
fix: prune optionalDeps ls compat
Browse files Browse the repository at this point in the history
Fixes a compatibility issue in `npm ls` due to the subtle internal
change of optional dependencies being pruned from dependencies in
`read-package-json-fast@2.0.0` update.
  • Loading branch information
ruyadorno committed Feb 8, 2021
1 parent 9ab36aa commit 27be528
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/ls.js
Expand Up @@ -163,7 +163,10 @@ const getJsonOutputItem = (node, { global, long }) => {
Object.assign(item, packageInfo)
item.extraneous = false
item.path = node.path
item._dependencies = node.package.dependencies || {}
item._dependencies = {
...node.package.dependencies,
...node.package.optionalDependencies,
}
item.devDependencies = node.package.devDependencies || {}
item.peerDependencies = node.package.peerDependencies || {}
}
Expand Down

0 comments on commit 27be528

Please sign in to comment.