@@ -4,7 +4,7 @@ const env = process.env.NODE_ENV || 'default';
44// Import dependencies
55const getCliArguments = require ( "command-line-args" ) ;
66const config = require ( "config" ) ;
7- const shell = require ( "child_process " ) ;
7+ const executeCommand = require ( "./execute-cmd " ) ;
88const fs = require ( "fs" ) ;
99
1010// Build chain functions
@@ -78,7 +78,7 @@ catch (ex) {
7878 // Check for config dir
7979 if ( ! fs . existsSync ( "config" ) ) {
8080 // Create dir
81- shell . execSync ( "mkdir config" ) ;
81+ executeCommand ( "mkdir config" ) ;
8282 }
8383
8484 // Check for environment config file
@@ -109,13 +109,18 @@ payload.build.force = cli.args.forceBuild;
109109
110110// Start the engine
111111console . log ( "Importing..." ) ;
112+ executeCommand ( importer . precmd ) ;
112113importer . run ( payload )
113114 . then ( ( payload ) => {
115+ executeCommand ( importer . postcmd ) ;
116+ executeCommand ( converter . precmd ) ;
114117 console . log ( "Converting..." ) ;
115118 return converter . run ( payload ) ;
116119 } )
117120 . then ( ( payload ) => {
121+ executeCommand ( converter . postcmd ) ;
118122 if ( builder . shouldBuild ( ) || cli . args . forceBuild ) {
123+ executeCommand ( builder . precmd ) ;
119124 console . log ( "Building..." ) ;
120125 return builder . run ( payload ) ;
121126 }
@@ -125,10 +130,15 @@ importer.run(payload)
125130 }
126131 } )
127132 . then ( ( payload ) => {
133+ if ( builder . shouldBuild ( ) || cli . args . forceBuild ) {
134+ executeCommand ( builder . postcmd ) ;
135+ }
136+ executeCommand ( exporter . precmd ) ;
128137 console . log ( "Exporting..." ) ;
129138 return exporter . run ( payload ) ;
130139 } )
131140 . then ( ( payload ) => {
141+ executeCommand ( exporter . postcmd ) ;
132142 console . log ( "Exported" , payload , "files." ) ;
133143 console . log ( "Finished." ) ;
134144 } )
0 commit comments