From 0d40bf3e69a8db739213a5fd14f6e997dccb4838 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Thu, 25 May 2017 14:37:46 -0700 Subject: 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. --- lib/install/mutate-into-logical-tree.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') 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 } -- cgit v1.2.3