diff --git a/start.js b/start.js index 7b15609a..c5cc5568 100644 --- a/start.js +++ b/start.js @@ -9,15 +9,20 @@ const terminalOptions = { stdio: "inherit", }; -const command = `nodemon ${ +function spawnOrFail(command) { + const result = spawnSync(command, terminalOptions); + if (result.status !== 0) { + process.exit(result.status); + } +} + +const command = `nodemon ${ DEBUG ? "--inspect" : "" } --watch './src/**/*.ts' --exec 'node --loader ts-node/esm' ./src/application.bootstrap.ts`; -console.log(command); - if (REFRESH) { - spawnSync("pnpm mikro-orm:cli migration:fresh", terminalOptions); - spawnSync("pnpm mikro-orm:cli seeder:run", terminalOptions); + spawnOrFail("pnpm mikro-orm:cli migration:fresh"); + spawnOrFail("pnpm mikro-orm:cli seeder:run"); } -spawnSync(command, terminalOptions); +spawnOrFail(command); diff --git a/test.js b/test.js index 887dc462..5a909cea 100644 --- a/test.js +++ b/test.js @@ -18,5 +18,8 @@ function spawnOrFail(command) { } } +if (process.env.CI) { + spawnOrFail("pnpm lint"); +} spawnOrFail("pnpm mikro-orm:cli migration:fresh"); spawnOrFail(`pnpm vitest --watch=false ${args.join(" ")}`);