diff options
author | Rebecca Turner <me@re-becca.org> | 2017-05-26 00:37:46 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-05-26 04:55:33 +0300 |
commit | 0d40bf3e69a8db739213a5fd14f6e997dccb4838 (patch) | |
tree | fbaee364526af3ce9b8d00244f8fb1fad4aa5e09 /lib | |
parent | da7bbb25fe347cb81395c6e1dc6b1f5b42f0a90f (diff) |
ls: Nothing is extraneous without a package.json
It used to be that we did this check in `is-extraneous` but it turns out to
be much cleaner to keep that pure. It let's us use `is-extraneous` for
things like pruning.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/install/mutate-into-logical-tree.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/install/mutate-into-logical-tree.js b/lib/install/mutate-into-logical-tree.js index 491f20913..018745cc5 100644 --- a/lib/install/mutate-into-logical-tree.js +++ b/lib/install/mutate-into-logical-tree.js @@ -7,6 +7,7 @@ var isExtraneous = require('./is-extraneous.js') var validateAllPeerDeps = require('./deps.js').validateAllPeerDeps var packageId = require('../utils/package-id.js') var moduleName = require('../utils/module-name.js') +var npm = require('../npm.js') // Return true if tree is a part of a cycle that: // A) Never connects to the top of the tree @@ -128,7 +129,7 @@ function translateTree_ (tree, seen) { pkg.path = tree.path pkg.error = tree.error - pkg.extraneous = isExtraneous(tree) + pkg.extraneous = !tree.isTop && (!tree.parent.isTop || !tree.parent.error) && !npm.config.get('global') && isExtraneous(tree) if (tree.target && tree.parent && !tree.parent.target) pkg.link = tree.realpath return pkg } |