diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/install.js | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/install.js b/lib/install.js index 20d3d0f96..cd64dc805 100644 --- a/lib/install.js +++ b/lib/install.js @@ -98,6 +98,7 @@ var path = require('path') // dependencies var log = require('npmlog') var readPackageTree = require('read-package-tree') +var readPackageJson = require('read-package-json') var chain = require('slide').chain var asyncMap = require('slide').asyncMap var archy = require('archy') @@ -245,6 +246,11 @@ Installer.prototype.run = function (_cb) { var installSteps = [] var postInstallSteps = [] + if (!this.dryrun) { + installSteps.push( + [this.newTracker(log, 'runTopLevelLifecycles', 2)], + [this, this.runPreinstallTopLevelLifecycles]) + } installSteps.push( [this.newTracker(log, 'loadCurrentTree', 4)], [this, this.loadCurrentTree], @@ -265,9 +271,6 @@ Installer.prototype.run = function (_cb) { [this, this.debugActions, 'decomposeActions', 'todo']) if (!this.dryrun) { installSteps.push( - [this.newTracker(log, 'runTopLevelLifecycles', 2)], - [this, this.runPreinstallTopLevelLifecycles], - [this.newTracker(log, 'executeActions', 8)], [this, this.executeActions], [this, this.finishTracker, 'executeActions']) @@ -551,10 +554,15 @@ Installer.prototype.runPreinstallTopLevelLifecycles = function (cb) { var steps = [] var trackLifecycle = this.progress.runTopLevelLifecycles - steps.push( - [doOneAction, 'preinstall', this.idealTree.path, this.idealTree, trackLifecycle.newGroup('preinstall:.')] - ) - chain(steps, cb) + readPackageJson(path.join(this.where, 'package.json'), log, false, (err, data) => { + if (err) return cb() + this.currentTree = createNode({ + isTop: true, + package: data, + path: this.where + }) + doOneAction('preinstall', this.where, this.currentTree, log.newGroup('preinstall:.'), cb) + }) } Installer.prototype.runPostinstallTopLevelLifecycles = function (cb) { |