Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/cache.js2
-rw-r--r--lib/install.js2
-rw-r--r--lib/unbuild.js14
3 files changed, 12 insertions, 6 deletions
diff --git a/lib/cache.js b/lib/cache.js
index 3501b69b9..313a4f0c6 100644
--- a/lib/cache.js
+++ b/lib/cache.js
@@ -1173,7 +1173,7 @@ function unpack (pkg, ver, unpackTarget, dMode, fMode, uid, gid, cb) {
log.error("unpack", "Could not read data for %s", pkg + "@" + ver)
return cb(er)
}
- npm.commands.unbuild([unpackTarget], function (er) {
+ npm.commands.unbuild([unpackTarget], true, function (er) {
if (er) return cb(er)
tar.unpack( path.join(npm.cache, pkg, ver, "package.tgz")
, unpackTarget
diff --git a/lib/install.js b/lib/install.js
index aca087db2..39d926721 100644
--- a/lib/install.js
+++ b/lib/install.js
@@ -982,7 +982,7 @@ function write (target, targetFolder, context, cb_) {
if (!er) return cb_(er, data)
if (false === npm.config.get("rollback")) return cb_(er)
- npm.commands.unbuild([targetFolder], function (er2) {
+ npm.commands.unbuild([targetFolder], true, function (er2) {
if (er2) log.error("error rolling back", target._id, er2)
return cb_(er, data)
})
diff --git a/lib/unbuild.js b/lib/unbuild.js
index a752acc52..ec34d5688 100644
--- a/lib/unbuild.js
+++ b/lib/unbuild.js
@@ -15,9 +15,12 @@ var readJson = require("read-package-json")
// args is a list of folders.
// remove any bins/etc, and then delete the folder.
-function unbuild (args, cb) { asyncMap(args, unbuild_, cb) }
+function unbuild (args, silent, cb) {
+ if (typeof silent === 'function') cb = silent, silent = false
+ asyncMap(args, unbuild_(silent), cb)
+}
-function unbuild_ (folder, cb) {
+function unbuild_ (silent) { return function (folder, cb) {
folder = path.resolve(folder)
delete build._didBuild[folder]
log.info(folder, "unbuild")
@@ -28,12 +31,16 @@ function unbuild_ (folder, cb) {
chain
( [ [lifecycle, pkg, "preuninstall", folder, false, true]
, [lifecycle, pkg, "uninstall", folder, false, true]
+ , !silent && function(cb) {
+ console.log("unbuild " + pkg._id)
+ cb()
+ }
, [rmStuff, pkg, folder]
, [lifecycle, pkg, "postuninstall", folder, false, true]
, [rm, folder] ]
, cb )
})
-}
+}}
function rmStuff (pkg, folder, cb) {
// if it's global, and folder is in {prefix}/node_modules,
@@ -46,7 +53,6 @@ function rmStuff (pkg, folder, cb) {
readJson.cache.del(path.resolve(folder, "package.json"))
log.verbose([top, gnm, parent], "unbuild " + pkg._id)
- console.log("unbuild " + pkg._id)
asyncMap([rmBins, rmMans], function (fn, cb) {
fn(pkg, folder, parent, top, cb)
}, cb)