@@ -259,6 +259,9 @@ Installer.prototype.run = function (cb) {
259259 [ this , this . debugActions , 'decomposeActions' , 'todo' ] )
260260 if ( ! this . dryrun ) {
261261 installSteps . push (
262+ [ this . newTracker ( log , 'runTopLevelLifecycles' , 2 ) ] ,
263+ [ this , this . runPreinstallTopLevelLifecycles ] ,
264+
262265 [ this . newTracker ( log , 'executeActions' , 8 ) ] ,
263266 [ this , this . executeActions ] ,
264267 [ this , this . finishTracker , 'executeActions' ] )
@@ -269,10 +272,9 @@ Installer.prototype.run = function (cb) {
269272 [ this , this . rollbackFailedOptional , staging , this . todo ] ,
270273 [ this , this . finishTracker , 'rollbackFailedOptional' ] ,
271274 [ this , this . commit , staging , this . todo ] ,
272- [ this . newTracker ( log , 'runTopLevelLifecycles' , 2 ) ] ,
273- [ this , this . runTopLevelLifecycles ] ,
274- [ this , this . finishTracker , 'runTopLevelLifecycles' ] )
275275
276+ [ this , this . runPostinstallTopLevelLifecycles ] ,
277+ [ this , this . finishTracker , 'runTopLevelLifecycles' ] )
276278 if ( getSaveType ( this . args ) ) {
277279 postInstallSteps . push (
278280 [ this , this . saveToDependencies ] )
@@ -520,19 +522,29 @@ Installer.prototype.commit = function (staging, actionsToRun, cb) {
520522 } , cb )
521523}
522524
523- Installer . prototype . runTopLevelLifecycles = function ( cb ) {
525+ Installer . prototype . runPreinstallTopLevelLifecycles = function ( cb ) {
524526 validate ( 'F' , arguments )
525527 if ( this . failing ) return cb ( )
526- log . silly ( 'install' , 'runTopLevelLifecycles' )
528+ if ( ! this . topLevelLifecycles ) return cb ( )
529+ log . silly ( 'install' , 'runPreinstallTopLevelLifecycles' )
530+ var steps = [ ]
531+ var trackLifecycle = this . progress . runTopLevelLifecycles
532+
533+ steps . push (
534+ [ doOneAction , 'preinstall' , this . idealTree . path , this . idealTree , trackLifecycle . newGroup ( 'preinstall:.' ) ]
535+ )
536+ chain ( steps , cb )
537+ }
538+
539+ Installer . prototype . runPostinstallTopLevelLifecycles = function ( cb ) {
540+ validate ( 'F' , arguments )
541+ if ( this . failing ) return cb ( )
542+ if ( ! this . topLevelLifecycles ) return cb ( )
543+ log . silly ( 'install' , 'runPostinstallTopLevelLifecycles' )
527544 var steps = [ ]
528545 var trackLifecycle = this . progress . runTopLevelLifecycles
529- if ( ! this . topLevelLifecycles ) {
530- trackLifecycle . finish ( )
531- return cb ( )
532- }
533546
534547 steps . push (
535- [ doOneAction , 'preinstall' , this . idealTree . path , this . idealTree , trackLifecycle . newGroup ( 'preinstall:.' ) ] ,
536548 [ doOneAction , 'build' , this . idealTree . path , this . idealTree , trackLifecycle . newGroup ( 'build:.' ) ] ,
537549 [ doOneAction , 'install' , this . idealTree . path , this . idealTree , trackLifecycle . newGroup ( 'install:.' ) ] ,
538550 [ doOneAction , 'postinstall' , this . idealTree . path , this . idealTree , trackLifecycle . newGroup ( 'postinstall:.' ) ] )
0 commit comments