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:
authorisaacs <i@izs.me>2012-08-22 02:13:29 +0400
committerisaacs <i@izs.me>2012-08-22 02:13:29 +0400
commit838ff2ab254a39da88a596ab74955cfb07fe091c (patch)
tree884a19bf3b499857a631bd82284321847e6a0467
parent780c7b67597a5e421e517c299eee10bb471f471c (diff)
dedupe: Handle dev/extraneous deps better
devDeps are ignored. Extraneous deps are treated as if they are required with '' as the range.
-rw-r--r--lib/dedupe.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/dedupe.js b/lib/dedupe.js
index 50908e319..9a357908a 100644
--- a/lib/dedupe.js
+++ b/lib/dedupe.js
@@ -83,7 +83,7 @@ function dedupe_ (dir, filter, unavoidable, dryrun, silent, cb) {
return d && d.parent && !d.parent.duplicate && !d.unavoidable
}).map(function M (d) {
return [d.path, d.version, d.dependents.map(function (k) {
- return [k.path, k.version, k.dependencies[d.name]]
+ return [k.path, k.version, k.dependencies[d.name] || ""]
})]
})]
}).map(function (item) {
@@ -298,6 +298,12 @@ function readInstalled (dir, counter, parent, cb) {
function next () {
if (!children || !pkg || !realpath) return
+
+ // ignore devDependencies. Just leave them where they are.
+ children = children.filter(function (c) {
+ return !pkg.devDependencies.hasOwnProperty(c)
+ })
+
pkg.realPath = realpath
if (pkg.realPath !== pkg.path) children = []
var d = path.resolve(dir, "node_modules")