refactor: dev label

This commit is contained in:
Carlos Valente
2024-07-16 19:48:03 +02:00
committed by Carlos Valente
parent 3056b75960
commit 2f65711078
5 changed files with 34 additions and 23 deletions
+20
View File
@@ -0,0 +1,20 @@
import { isProduction } from '../setup/index.js';
import { consoleError } from '../utils/console.js';
/**
* Milestone checker for dev environment
* will terminate process if check returns true
* Ideally we would like to remove the call to this function on build
*/
export function shouldCrashDev(check: boolean, reason: string) {
if (isProduction) {
return;
}
if (!check) {
return;
}
consoleError(new Error(reason).stack ?? '');
process.exit(2);
}