diff options
author | Rebecca Turner <me@re-becca.org> | 2015-06-22 09:54:22 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-06-26 03:27:32 +0300 |
commit | 2da0ce83e1e3f8c8190c455764a4c8f4a0521c18 (patch) | |
tree | 21f7945c0e05fa457ee7ed12cd8e8e227eb49c29 /lib/install.js | |
parent | 8a814a65b956b381109406b6f5beed048963f235 (diff) |
install: Run top level lifecycles AFTER rolling back failed optdeps
This is necessary because the top level lifecycles run commands that
read the node_modules folder to decide what to do. 😕
Diffstat (limited to 'lib/install.js')
-rw-r--r-- | lib/install.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/install.js b/lib/install.js index 3b869203a..350b54c7a 100644 --- a/lib/install.js +++ b/lib/install.js @@ -224,13 +224,15 @@ Installer.prototype.run = function (cb) { installSteps.push( [this.newTracker(log, 'executeActions', 8)], [this, this.executeActions], - [this, this.finishTracker, 'executeActions'], - [this, this.runTopLevelLifecycles]) + [this, this.finishTracker, 'executeActions']) var node_modules = path.resolve(this.where, 'node_modules') var staging = path.resolve(node_modules, '.staging') postInstallSteps.push( - [this.newTracker(log, 'runTopLevelLifecycles', 2)], + [this.newTracker(log, 'rollbackFailedOptional', 1)], [this, this.rollbackFailedOptional, staging, this.todo], + [this, this.finishTracker, 'rollbackFailedOptional'], + [this.newTracker(log, 'runTopLevelLifecycles', 2)], + [this, this.runTopLevelLifecycles], [this, this.finishTracker, 'runTopLevelLifecycles']) if (getSaveType(this.args)) { @@ -243,6 +245,7 @@ Installer.prototype.run = function (cb) { var self = this chain(installSteps, function (installEr) { + if (installEr) self.failing = true chain(postInstallSteps, function (postInstallEr) { if (self.idealTree) { self.idealTree.warnings.forEach(function (warning) { @@ -471,6 +474,7 @@ Installer.prototype.rollbackFailedOptional = function (staging, actionsToRun, cb Installer.prototype.runTopLevelLifecycles = function (cb) { validate('F', arguments) + if (this.failing) return cb() log.silly('install', 'runTopLevelLifecycles') var steps = [] var trackLifecycle = this.progress.runTopLevelLifecycles |