summaryrefslogtreecommitdiff
path: root/deps/npm/lib/unbuild.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/unbuild.js')
-rw-r--r--deps/npm/lib/unbuild.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/deps/npm/lib/unbuild.js b/deps/npm/lib/unbuild.js
index df57c5b346..ede8482c40 100644
--- a/deps/npm/lib/unbuild.js
+++ b/deps/npm/lib/unbuild.js
@@ -5,6 +5,7 @@ var readJson = require("read-package-json")
, gentlyRm = require("./utils/gently-rm.js")
, npm = require("./npm.js")
, path = require("path")
+ , isInside = require("path-is-inside")
, lifecycle = require("./utils/lifecycle.js")
, asyncMap = require("slide").asyncMap
, chain = require("slide").chain
@@ -23,11 +24,12 @@ function unbuild_ (silent) { return function (folder, cb_) {
cb_(er, path.relative(npm.root, folder))
}
folder = path.resolve(folder)
+ var base = isInside(folder, npm.prefix) ? npm.prefix : folder
delete build._didBuild[folder]
log.verbose("unbuild", folder.substr(npm.prefix.length + 1))
readJson(path.resolve(folder, "package.json"), function (er, pkg) {
// if no json, then just trash it, but no scripts or whatever.
- if (er) return gentlyRm(folder, false, npm.prefix, cb)
+ if (er) return gentlyRm(folder, false, base, cb)
readJson.cache.del(folder)
chain
( [ [lifecycle, pkg, "preuninstall", folder, false, true]
@@ -38,7 +40,7 @@ function unbuild_ (silent) { return function (folder, cb_) {
}
, [rmStuff, pkg, folder]
, [lifecycle, pkg, "postuninstall", folder, false, true]
- , [gentlyRm, folder, false, npm.prefix] ]
+ , [gentlyRm, folder, false, base] ]
, cb )
})
}}