aboutsummaryrefslogtreecommitdiffstats
path: root/app/index.ts
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2023-08-27 10:43:47 +0100
committerLeonardo Bishop <me@leonardobishop.com>2023-08-27 10:44:03 +0100
commitce7ec8a43d874fecec705cfc570fd864a905d1d2 (patch)
treec25135b68454a2fccb9e11f2334a3c40bb5c16b1 /app/index.ts
parentb7ff13ed4c217f2af827a4fa02390cafe9775c60 (diff)
Add proper exit code for build failure
Diffstat (limited to 'app/index.ts')
-rw-r--r--app/index.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/index.ts b/app/index.ts
index 1cb278a..f7a443d 100644
--- a/app/index.ts
+++ b/app/index.ts
@@ -21,12 +21,19 @@ logger.info('');
const {success, errors, pageDirectory} = await buildPages();
logger.info('');
-if (!success) {
+if (!success && errors == 0) {
logger.error(`Build failed. Quitting.`);
process.exit(1);
}
-logger.info(`Finished${errors > 0 ? `, with ${errors} errors` : ''}. Build took ${new Date().getTime() - startDate.getTime()}ms.`);
+const exitString = `Finished${errors > 0 ? `, with ${errors} errors` : ''}. Build took ${new Date().getTime() - startDate.getTime()}ms.`;
+
+if (!success) {
+ logger.error(exitString);
+ process.exit(1);
+} else {
+ logger.info(exitString);
+}
if (process.env.WEBSERVER_ENABLED === 'true') {
logger.info('');