diff options
Diffstat (limited to 'deps/npm/lib/install/validate-tree.js')
-rw-r--r-- | deps/npm/lib/install/validate-tree.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/deps/npm/lib/install/validate-tree.js b/deps/npm/lib/install/validate-tree.js index e89cd6fdd2..ccd4e2e310 100644 --- a/deps/npm/lib/install/validate-tree.js +++ b/deps/npm/lib/install/validate-tree.js @@ -26,7 +26,8 @@ module.exports = function (idealTree, log, next) { ], done) }], [thenValidateAllPeerDeps, idealTree], - [thenCheckTop, idealTree] + [thenCheckTop, idealTree], + [thenCheckDuplicateDeps, idealTree] ], andFinishTracker(log, next)) } @@ -73,5 +74,22 @@ function thenCheckTop (idealTree, next) { warnObj.code = 'ENODEPRE' idealTree.warnings.push(warnObj) } + + next() +} + +// check for deps duplciated between devdeps and regular deps +function thenCheckDuplicateDeps (idealTree, next) { + var deps = idealTree.package.dependencies || {} + var devDeps = idealTree.package.devDependencies || {} + + for (var pkg in devDeps) { + if (pkg in deps) { + var warnObj = new Error('The package ' + pkg + ' is included as both a dev and production dependency.') + warnObj.code = 'EDUPLICATEDEP' + idealTree.warnings.push(warnObj) + } + } + next() } |