Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/ls.js
diff options
context:
space:
mode:
authorRuy Adorno <ruyadorno@hotmail.com>2021-02-08 22:35:56 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2021-02-08 23:24:48 +0300
commit27be528ebb9801f8cccbfd30c19ddea4537adf8a (patch)
tree4241efb0b6d3e2c9637a519eb9170bbef80059d3 /lib/ls.js
parent9ab36aae429784df754211d5f086a515012b9bdd (diff)
fix: prune optionalDeps ls compat
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.
Diffstat (limited to 'lib/ls.js')
-rw-r--r--lib/ls.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ls.js b/lib/ls.js
index 153759d83..603c3b412 100644
--- a/lib/ls.js
+++ b/lib/ls.js
@@ -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 || {}
}