diff options
author | isaacs <i@izs.me> | 2010-08-25 01:57:12 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-08-25 16:21:51 +0400 |
commit | 3781a298baf83ed3f2550c2afc09885738780595 (patch) | |
tree | 2a44537f3ad7076b35211c5e880f0d02ed221730 | |
parent | 9cde9608132aa73806943622bcba05f463e99d30 (diff) |
Add support for package defaults in uninstall and deactivate
-rw-r--r-- | lib/deactivate.js | 14 | ||||
-rw-r--r-- | lib/uninstall.js | 16 |
2 files changed, 19 insertions, 11 deletions
diff --git a/lib/deactivate.js b/lib/deactivate.js index 9b9c9df54..0af8c782b 100644 --- a/lib/deactivate.js +++ b/lib/deactivate.js @@ -9,6 +9,7 @@ var mkdir = require("./utils/mkdir-p") , lifecycle = require("./utils/lifecycle") , readJson = require("./utils/read-json") , asyncMap = require("./utils/async-map") + , loadPackageDefaults = require("./utils/load-package-defaults") module.exports = deactivate @@ -59,11 +60,14 @@ function preDeactivate (pkg, cb) { data.version = version data._id = data.name+"-"+data.version npm.set(data) - chain - ( [lifecycle, data, "predeactivate"] - , [lifecycle, data, "deactivate"] - , function (er) { cb(er, data) } - ) + loadPackageDefaults(data, function (er, data) { + if (er) return cb(er) + chain + ( [lifecycle, data, "predeactivate"] + , [lifecycle, data, "deactivate"] + , function (er) { cb(er, data) } + ) + }) }) }) } diff --git a/lib/uninstall.js b/lib/uninstall.js index 7d614e781..72741ebcb 100644 --- a/lib/uninstall.js +++ b/lib/uninstall.js @@ -17,6 +17,7 @@ var rm = require("./utils/rm-rf") , readInstalled = require("./utils/read-installed") , mkdir = require("./utils/mkdir-p") , asyncMap = require("./utils/async-map") + , loadPackageDefaults = require("./utils/load-package-defaults") function uninstall (args, cb) { @@ -54,12 +55,15 @@ function unpackArgs (rawArgs, cb) { readJson( jsonFile , arg[1] , function (er, data) { - if (er) return cb(er) - data.version = arg[1] - data._id = data.name+"-"+data.version - argData.push(data) - argData[data._id] = data - R(args.pop()) + if (er) return cb(er) + loadPackageDefaults(data, function (er, data) { + if (er) return cb(er) + data.version = arg[1] + data._id = data.name+"-"+data.version + argData.push(data) + argData[data._id] = data + R(args.pop()) + }) } ) })(args.pop()) |