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:
authorRebecca Turner <me@re-becca.org>2015-06-15 18:54:45 +0300
committerRebecca Turner <me@re-becca.org>2015-06-26 03:27:14 +0300
commita570d714c5324b8a8ca6bca3e53760858454054c (patch)
treefbad606ef3861f2cc7fef2ed4eb4893a62d3cc6e /lib/install.js
parent092ae44a12536745e406b6b9c2800fa08b6994e7 (diff)
rollback: Don't do it if --rollback=false was set
Diffstat (limited to 'lib/install.js')
-rw-r--r--lib/install.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/install.js b/lib/install.js
index 6673e06ce..08a24e023 100644
--- a/lib/install.js
+++ b/lib/install.js
@@ -192,6 +192,7 @@ function Installer (where, dryrun, args) {
this.topLevelLifecycles = !args.length
this.npat = npm.config.get('npat')
this.dev = !npm.config.get('production')
+ this.rollback = npm.config.get('rollback')
}
Installer.prototype = {}
@@ -382,14 +383,20 @@ Installer.prototype.executeActions = function (cb) {
steps.push(
[doParallelActions, 'test', staging, todo, trackLifecycle.newGroup('npat')])
}
- steps.push(
- // TODO add check that .staging is empty? DUBIOUS
- [rimraf, staging])
- chain(steps, cb)
+ var self = this
+ chain(steps, function (er) {
+ if (!er || self.rollback) {
+ rimraf(staging, function () { cb(er) })
+ }
+ else {
+ cb(er)
+ }
+ })
}
Installer.prototype.rollbackFailedOptional = function (staging, actionsToRun, cb) {
+ if (!this.rollback) return cb()
var failed = actionsToRun.map(function (action) { return action[1] }).filter(function (pkg) { return pkg.failed && pkg.rollback })
asyncMap(failed, function (pkg, next) {
asyncMap(pkg.rollback, function (rollback, done) {