Commit 93afa9e7 authored by ThinhNC's avatar ThinhNC

fix(build): move prisma to dependencies and harden prisma-run for linux

parent b68ff0d7
......@@ -51,7 +51,8 @@
"rate-limit-redis": "^6.0.1",
"swagger-ui-express": "^5.0.1",
"turndown": "^7.2.0",
"zod": "^3.24.1"
"zod": "^3.24.1",
"prisma": "^5.22.0"
},
"devDependencies": {
"@types/archiver": "^6.0.3",
......@@ -73,7 +74,6 @@
"eslint": "^9.17.0",
"jest": "^30.4.2",
"prettier": "^3.4.2",
"prisma": "^5.22.0",
"swagger-autogen": "^2.23.7",
"ts-jest": "^29.4.11",
"ts-node": "^10.9.2",
......
......@@ -77,6 +77,9 @@ importers:
nodemailer:
specifier: ^9.0.3
version: 9.0.3
prisma:
specifier: ^5.22.0
version: 5.22.0
rate-limit-redis:
specifier: ^6.0.1
version: 6.0.1(express-rate-limit@8.5.2(express@4.22.2))
......@@ -147,9 +150,6 @@ importers:
prettier:
specifier: ^3.4.2
version: 3.9.4
prisma:
specifier: ^5.22.0
version: 5.22.0
swagger-autogen:
specifier: ^2.23.7
version: 2.23.7
......
......@@ -4,7 +4,7 @@ services:
env: node
plan: free
region: singapore
buildCommand: pnpm install --frozen-lockfile && pnpm prisma:generate && pnpm build
buildCommand: pnpm install --frozen-lockfile --prod=false && pnpm prisma:generate && pnpm build
startCommand: pnpm start
healthCheckPath: /health/liveness
envVars:
......
......@@ -14,12 +14,25 @@ if (!process.env.DATABASE_URL) {
process.env.DATABASE_URL = `postgresql://${user}:${password}@${host}:${port}/${name}?schema=public${ssl}`;
}
const path = require("path");
const fs = require("fs");
const args = process.argv.slice(2);
const cmd = process.platform === "win32" ? "npx.cmd" : "npx";
const child = spawn(cmd, ["prisma", ...args], {
const isWin = process.platform === "win32";
const localBin = path.resolve(
__dirname,
`../node_modules/.bin/prisma${isWin ? ".cmd" : ""}`
);
const [cmd, cmdArgs] = fs.existsSync(localBin)
? [localBin, args]
: [isWin ? "npx.cmd" : "npx", ["prisma", ...args]];
const child = spawn(cmd, cmdArgs, {
stdio: "inherit",
env: process.env,
shell: true,
shell: isWin,
});
child.on("exit", (code) => process.exit(code ?? 1));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment