Skip to content

Commit

Permalink
improve scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
AmauryD committed Nov 12, 2023
1 parent 192ab40 commit 6512fd6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
17 changes: 11 additions & 6 deletions start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
3 changes: 3 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ")}`);

0 comments on commit 6512fd6

Please sign in to comment.