@@ -52,7 +52,7 @@ internals.runScript = (stage, { childPkg, path, cwd }) => {
52
52
console . log ( ) ;
53
53
console . log ( `==========> ${ stage } ${ path } ...` ) ;
54
54
55
- Npm . runScript ( childPkg , stage , Path . join ( cwd , path ) , {
55
+ return Npm . runScript ( childPkg , stage , Path . join ( cwd , path ) , {
56
56
dir : cwd ,
57
57
log : Object . assign ( {
58
58
pause : ( ) => { } ,
@@ -66,7 +66,7 @@ internals.runScript = (stage, { childPkg, path, cwd }) => {
66
66
} ) ;
67
67
} ;
68
68
69
- exports . run = ( cmd = 'install' ) => {
69
+ exports . run = async ( cmd = 'install' ) => {
70
70
71
71
const cwd = process . cwd ( ) ;
72
72
const pkg = require ( Path . join ( cwd , 'package.json' ) ) ;
@@ -103,7 +103,15 @@ exports.run = (cmd = 'install') => {
103
103
return allowScripts [ name ] ;
104
104
} ) ;
105
105
106
- allowedScripts . forEach ( ( [ path , childPkg ] ) => internals . runScript ( 'preinstall' , { childPkg, path, cwd } ) ) ;
107
- allowedScripts . forEach ( ( [ path , childPkg ] ) => internals . runScript ( 'install' , { childPkg, path, cwd } ) ) ;
108
- allowedScripts . forEach ( ( [ path , childPkg ] ) => internals . runScript ( 'postinstall' , { childPkg, path, cwd } ) ) ;
106
+ for ( const [ path , childPkg ] of allowedScripts ) {
107
+ await internals . runScript ( 'preinstall' , { childPkg, path, cwd } ) ;
108
+ }
109
+
110
+ for ( const [ path , childPkg ] of allowedScripts ) {
111
+ await internals . runScript ( 'install' , { childPkg, path, cwd } ) ;
112
+ }
113
+
114
+ for ( const [ path , childPkg ] of allowedScripts ) {
115
+ await internals . runScript ( 'postinstall' , { childPkg, path, cwd } ) ;
116
+ }
109
117
} ;
0 commit comments