Skip to content

Commit ec3db49

Browse files
committed
📓 Adds in-code docs to rebiuld app server function
1 parent c717134 commit ec3db49

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

services/rebuild-app.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
const { exec } = require('child_process');
66

77
module.exports = () => new Promise((resolve, reject) => {
8-
const buildProcess = exec('npm run build');
8+
const buildProcess = exec('npm run build'); // Trigger the build command
99

10-
let output = '';
10+
let output = ''; // Will store console output
1111

12+
// Write output to console, and append to var for returning
1213
buildProcess.stdout.on('data', (data) => {
1314
process.stdout.write(data);
1415
output += data;
1516
});
1617

18+
// Handle errors, by sending the reject
1719
buildProcess.on('error', (error) => {
1820
reject(Error({
1921
success: false,
@@ -22,6 +24,7 @@ module.exports = () => new Promise((resolve, reject) => {
2224
}));
2325
});
2426

27+
// When finished, check success, make message and resolve response
2528
buildProcess.on('exit', (response) => {
2629
const success = response === 0;
2730
const message = `Build process exited with ${response}: `

0 commit comments

Comments
 (0)