Skip to content

Commit

Permalink
fix(build): build prod exits with code 1 if anything goes wrong (#10016)
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Krick <[email protected]>
Co-authored-by: Matt Krick <[email protected]>
  • Loading branch information
rafaelromcar-parabol and mattkrick authored Jul 31, 2024
1 parent 936f1f6 commit 1ed6a82
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@ const generateGraphQLArtifacts = require('./generateGraphQLArtifacts')
const cp = require('child_process')

const runChild = (cmd) => {
return new Promise((resolve) => {
const build = cp.exec(cmd).on('exit', resolve)
return new Promise((resolve, reject) => {
const build = cp.exec(cmd).on('exit', (code, signal) => {
if (code !== 0) {
reject(new Error(`Received non-zero exit code ${code}`))
} else if (signal) {
reject(new Error(`Received signal ${signal}`))
} else {
resolve()
}
})
build.stderr.pipe(process.stderr)
})
}
Expand All @@ -14,6 +22,7 @@ const prod = async (isDeploy, noDeps) => {
await generateGraphQLArtifacts()
} catch (e) {
console.log('ERR generating artifacts', e)
process.exit(1)
}

console.log('starting webpack build')
Expand All @@ -28,6 +37,7 @@ const prod = async (isDeploy, noDeps) => {
])
} catch (e) {
console.log('error webpackifying', e)
process.exit(1)
}
}

Expand Down

0 comments on commit 1ed6a82

Please sign in to comment.