Permalink
Browse files

dedupe: Handle dev/extraneous deps better

devDeps are ignored.  Extraneous deps are treated as if they are
required with '' as the range.
  • Loading branch information...
1 parent 780c7b6 commit 838ff2ab254a39da88a596ab74955cfb07fe091c @isaacs isaacs committed Aug 21, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/dedupe.js
View
8 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")

0 comments on commit 838ff2a

Please sign in to comment.