diff options
author | Rebecca Turner <me@re-becca.org> | 2015-04-15 03:35:52 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-06-26 03:26:47 +0300 |
commit | 2dc44fd4315b08f8602a337cbc808378f21460ca (patch) | |
tree | a30e1eb10556cdfc7b6bf317f9f403040b7936d8 /lib/dedupe.js | |
parent | 2872630d4998fb983c933f5da68a374a3670b57f (diff) |
Filter out all of the modules not currently in play with global operations
This is safe to do globally as deps of globals are NEVER hoisted out of
the global. Each global is self contained.
Diffstat (limited to 'lib/dedupe.js')
-rw-r--r-- | lib/dedupe.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/dedupe.js b/lib/dedupe.js index fc97ebf36..36cc63cb0 100644 --- a/lib/dedupe.js +++ b/lib/dedupe.js @@ -35,6 +35,19 @@ function Deduper (where, dryrun) { this.noPackageJsonOk = true } util.inherits(Deduper, Installer) + +Deduper.prototype.normalizeTree = function (log, cb) { + validate('OF', arguments) + // If we're looking globally only look at the one package we're operating on + if (npm.config.get('global')) { + var args = this.args + this.currentTree.children = this.currentTree.children.filter(function (child) { + return args.filter(function (arg) { return arg === child.package.name }).length + }) + } + Installer.prototype.normalizeTree.call(this, log, cb) +} + Deduper.prototype.loadAllDepsIntoIdealTree = function (cb) { validate('F', arguments) var idealTree = this.idealTree |