From 87217f9a3feb0cb9918c696790f01c2340685a37 Mon Sep 17 00:00:00 2001 From: Pablo Fernandez
Date: Sat, 21 Sep 2024 13:44:35 -0400 Subject: [PATCH] updates --- scripts/start.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 scripts/start.ts diff --git a/scripts/start.ts b/scripts/start.ts new file mode 100644 index 0000000..41c2396 --- /dev/null +++ b/scripts/start.ts @@ -0,0 +1,22 @@ +import { execSync, spawn } from "child_process"; + +try { + console.log(`Running migrations`); + // check if config folder exists + if (!fs.existsSync('./config')) { + execSync(`mkdir config`); + } + execSync('npm run prisma:migrate'); +} catch (error) { + console.log(error); + // Handle any potential migration errors here +} + +const args = process.argv.slice(2); +const childProcess = spawn('node', ['./dist/index.js', ...args], { + stdio: 'inherit', +}); + +childProcess.on('exit', (code) => { + process.exit(code); +});