Permalink
Browse files

Fix: bundleDependencies being re-installed unnecessarily

  • Loading branch information...
1 parent 594bbbd commit 6cda571679632c35f468c805afeb7722d7c7b647 @isaacs isaacs committed Mar 6, 2012
View
@@ -492,8 +492,7 @@ function targetResolver (where, context, deps) {
// check for a version installed higher in the tree.
// If installing from a shrinkwrap, it must match exactly.
if (context.family[what]) {
-
- if (wrap && wrap[what].version == context.family[what]) {
+ if (wrap && wrap[what].version === context.family[what]) {
log.verbose(what, "using existing (matches shrinkwrap)")
return cb(null, [])
}
@@ -727,6 +726,14 @@ function write (target, targetFolder, context, cb_) {
// before continuing to installing dependencies, check for a shrinkwrap.
readDependencies(context, targetFolder, {}, function (er, data, wrap) {
var deps = Object.keys(data.dependencies || {})
+
+ // don't install bundleDependencies
+ if (data.bundleDependencies) {
+ deps = deps.filter(function (d) {
+ return data.bundleDependencies.indexOf(d) === -1
+ })
+ }
+
var newcontext = { family: family
, ancestors: context.ancestors
, parent: target
@@ -0,0 +1,29 @@
+{
+ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
+ "name": "minimatch",
+ "description": "a glob matcher in javascript",
+ "version": "0.2.1",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/isaacs/minimatch.git"
+ },
+ "main": "minimatch.js",
+ "scripts": {
+ "test": "tap test"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "dependencies": {
+ "lru-cache": "~1.0.5"
+ },
+ "devDependencies": {
+ "tap": "~0.1.3"
+ },
+ "licenses" : [
+ {
+ "type" : "MIT",
+ "url" : "http://github.com/isaacs/minimatch/raw/master/LICENSE"
+ }
+ ]
+}
@@ -0,0 +1,4 @@
+{"name":"npm-test-bundled-git"
+,"version":"1.2.5"
+,"dependencies":{"glob":"git://github.com/isaacs/node-glob.git#npm-test"}
+,"bundledDependencies":["glob"]}
@@ -0,0 +1,9 @@
+#!/usr/bin/bash
+
+d=$(diff node_modules/glob/node_modules/minimatch/package.json minimatch-expected.json)
+
+if [ "$d" != "" ]; then
+ echo "didn't get expected minimatch/package.json" >&2
+ echo "$d" >&2
+ exit 1
+fi

0 comments on commit 6cda571

Please sign in to comment.