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 @@ ...@@ -51,7 +51,8 @@
"rate-limit-redis": "^6.0.1", "rate-limit-redis": "^6.0.1",
"swagger-ui-express": "^5.0.1", "swagger-ui-express": "^5.0.1",
"turndown": "^7.2.0", "turndown": "^7.2.0",
"zod": "^3.24.1" "zod": "^3.24.1",
"prisma": "^5.22.0"
}, },
"devDependencies": { "devDependencies": {
"@types/archiver": "^6.0.3", "@types/archiver": "^6.0.3",
...@@ -73,7 +74,6 @@ ...@@ -73,7 +74,6 @@
"eslint": "^9.17.0", "eslint": "^9.17.0",
"jest": "^30.4.2", "jest": "^30.4.2",
"prettier": "^3.4.2", "prettier": "^3.4.2",
"prisma": "^5.22.0",
"swagger-autogen": "^2.23.7", "swagger-autogen": "^2.23.7",
"ts-jest": "^29.4.11", "ts-jest": "^29.4.11",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
......
...@@ -77,6 +77,9 @@ importers: ...@@ -77,6 +77,9 @@ importers:
nodemailer: nodemailer:
specifier: ^9.0.3 specifier: ^9.0.3
version: 9.0.3 version: 9.0.3
prisma:
specifier: ^5.22.0
version: 5.22.0
rate-limit-redis: rate-limit-redis:
specifier: ^6.0.1 specifier: ^6.0.1
version: 6.0.1(express-rate-limit@8.5.2(express@4.22.2)) version: 6.0.1(express-rate-limit@8.5.2(express@4.22.2))
...@@ -147,9 +150,6 @@ importers: ...@@ -147,9 +150,6 @@ importers:
prettier: prettier:
specifier: ^3.4.2 specifier: ^3.4.2
version: 3.9.4 version: 3.9.4
prisma:
specifier: ^5.22.0
version: 5.22.0
swagger-autogen: swagger-autogen:
specifier: ^2.23.7 specifier: ^2.23.7
version: 2.23.7 version: 2.23.7
......
...@@ -4,7 +4,7 @@ services: ...@@ -4,7 +4,7 @@ services:
env: node env: node
plan: free plan: free
region: singapore 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 startCommand: pnpm start
healthCheckPath: /health/liveness healthCheckPath: /health/liveness
envVars: envVars:
......
...@@ -14,12 +14,25 @@ if (!process.env.DATABASE_URL) { ...@@ -14,12 +14,25 @@ if (!process.env.DATABASE_URL) {
process.env.DATABASE_URL = `postgresql://${user}:${password}@${host}:${port}/${name}?schema=public${ssl}`; 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 args = process.argv.slice(2);
const cmd = process.platform === "win32" ? "npx.cmd" : "npx"; const isWin = process.platform === "win32";
const child = spawn(cmd, ["prisma", ...args], { 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", stdio: "inherit",
env: process.env, env: process.env,
shell: true, shell: isWin,
}); });
child.on("exit", (code) => process.exit(code ?? 1)); 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