File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 5
5
const { exec } = require ( 'child_process' ) ;
6
6
7
7
module . exports = ( ) => new Promise ( ( resolve , reject ) => {
8
- const buildProcess = exec ( 'npm run build' ) ;
8
+ const buildProcess = exec ( 'npm run build' ) ; // Trigger the build command
9
9
10
- let output = '' ;
10
+ let output = '' ; // Will store console output
11
11
12
+ // Write output to console, and append to var for returning
12
13
buildProcess . stdout . on ( 'data' , ( data ) => {
13
14
process . stdout . write ( data ) ;
14
15
output += data ;
15
16
} ) ;
16
17
18
+ // Handle errors, by sending the reject
17
19
buildProcess . on ( 'error' , ( error ) => {
18
20
reject ( Error ( {
19
21
success : false ,
@@ -22,6 +24,7 @@ module.exports = () => new Promise((resolve, reject) => {
22
24
} ) ) ;
23
25
} ) ;
24
26
27
+ // When finished, check success, make message and resolve response
25
28
buildProcess . on ( 'exit' , ( response ) => {
26
29
const success = response === 0 ;
27
30
const message = `Build process exited with ${ response } : `
You can’t perform that action at this time.
0 commit comments