diff options
author | isaacs <i@izs.me> | 2010-08-26 07:00:46 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-08-26 07:00:46 +0400 |
commit | a3e070edd31644a77699b926ad78c066f8e93cd8 (patch) | |
tree | 5da94d570a1c44ceb7d834320c192e334c2ede02 /lib | |
parent | 033cf742230ce4c76d7a3cc5528ae41e34cfd0fc (diff) |
Bubble up the rmList with known-ok-to-remove packages, so a non-update doesn't bork the install of a new version.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/update-dependents.js | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/update-dependents.js b/lib/update-dependents.js index 71c6b7f95..7499ae134 100644 --- a/lib/update-dependents.js +++ b/lib/update-dependents.js @@ -50,23 +50,21 @@ function updateDependents (args, cb) { if (!args.length) return log( "Nothing to update", "update dependents", cb) asyncMap(args, function (arg, cb) { - chain - ( [lifecycle, arg, "preupdatedependents"] - , [updateDepsTo, arg] - , [lifecycle, arg, "updatedependents"] - , [lifecycle, arg, "postupdatedependents"] - , cb - ) - }, function (er) { + lifecycle(arg, "preupdatedependents", function (er) { + if (er) return cb(er) + updateDepsTo(arg, function (er, rmList) { + if (er) return cb(er) + chain + ( [lifecycle, arg, "updatedependents"] + , [lifecycle, arg, "postupdatedependents"] + , function (er) { cb(er, rmList) } + ) + }) + }) + }, function (er, rmList) { if (er) return cb(er) // now they've all been updated, so remove the others. - var rmList = [] - args.forEach(function (arg) { - // if (!arg._others) log(arg); return - arg._others.forEach(function (o) { - rmList.push(arg.name+"@"+o) - }) - }) + log.verbose(rmList.join("\n"), "updateDependents: rm") npm.commands.rm(rmList, cb) }) }) @@ -133,7 +131,7 @@ function updateDepToNew (depName, depVer, pkg, other, cb) { chain ( [ removeDependencyLinks, data, pkg, other ] , [ createDependencyLinks, data, pkg ] - , cb + , function (er) { cb(er, pkg.name+"@"+other) } ) }) } |