From 265e62b0f9b468fef72fdd814528f2d814fc7f1c Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:31:34 +1000 Subject: [PATCH] fix(build): don't exit process until files are written --- build.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/build.js b/build.js index b76ef15c..16ddf730 100644 --- a/build.js +++ b/build.js @@ -61,11 +61,14 @@ const client = await getContext('client', { }); async function build() { - return Promise.all([server.rebuild(), client.rebuild()]).then(() => { - writeFile('.yarn.installed', new Date().toISOString()); - writeFile( - 'fxmanifest.lua', - `fx_version 'cerulean' + const built = await Promise.all([server.rebuild(), client.rebuild()]); + + if (!built) return; + + await writeFile('.yarn.installed', new Date().toISOString()); + await writeFile( + 'fxmanifest.lua', + `fx_version 'cerulean' game 'gta5' name '${pkg.name}' @@ -91,8 +94,7 @@ client_script 'dist/client.js' server_script 'dist/server.js' ` - ); - }); + ); } const tsc = spawn(`tsc --build ${production ? '' : '--watch --preserveWatchOutput'} && tsc-alias`, {