mirror of https://github.com/Lissy93/dashy.git
📓 Adds in-code docs to rebiuld app server function
This commit is contained in:
parent
c717134b08
commit
ec3db490b2
|
@ -5,15 +5,17 @@
|
|||
const { exec } = require('child_process');
|
||||
|
||||
module.exports = () => new Promise((resolve, reject) => {
|
||||
const buildProcess = exec('npm run build');
|
||||
const buildProcess = exec('npm run build'); // Trigger the build command
|
||||
|
||||
let output = '';
|
||||
let output = ''; // Will store console output
|
||||
|
||||
// Write output to console, and append to var for returning
|
||||
buildProcess.stdout.on('data', (data) => {
|
||||
process.stdout.write(data);
|
||||
output += data;
|
||||
});
|
||||
|
||||
// Handle errors, by sending the reject
|
||||
buildProcess.on('error', (error) => {
|
||||
reject(Error({
|
||||
success: false,
|
||||
|
@ -22,6 +24,7 @@ module.exports = () => new Promise((resolve, reject) => {
|
|||
}));
|
||||
});
|
||||
|
||||
// When finished, check success, make message and resolve response
|
||||
buildProcess.on('exit', (response) => {
|
||||
const success = response === 0;
|
||||
const message = `Build process exited with ${response}: `
|
||||
|
|
Loading…
Reference in New Issue