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
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2015-04-15 03:35:52 +0300
committerRebecca Turner <me@re-becca.org>2015-06-26 03:26:47 +0300
commit2dc44fd4315b08f8602a337cbc808378f21460ca (patch)
treea30e1eb10556cdfc7b6bf317f9f403040b7936d8 /lib/dedupe.js
parent2872630d4998fb983c933f5da68a374a3670b57f (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.js13
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