first commit

This commit is contained in:
KodekaTeam committed 2026-06-02 00:17:50 +07:00
1 parent abb09fbea8
commit 72f6d49818
355 files changed
+121239 -3

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
const fs = require("fs");
const path = require("path");
const { spawnSync } = require("child_process");
const backendRoot = path.resolve(__dirname, "..");
const generatedClientTypesPath = path.join(
backendRoot,
"node_modules",
".prisma",
"client",
"index.d.ts",
);
function hasGeneratedPrismaClient() {
if (!fs.existsSync(generatedClientTypesPath)) {
return false;
}
const content = fs.readFileSync(generatedClientTypesPath, "utf8");
return (
content.includes("export type Server =") &&
!content.includes("export declare const PrismaClient: any")
);
}
if (hasGeneratedPrismaClient()) {
console.log("Prisma client already generated.");
process.exit(0);
}
console.log("Prisma client missing or placeholder detected. Running prisma generate...");
const command = process.platform === "win32" ? "npx.cmd" : "npx";
const result = spawnSync(command, ["prisma", "generate"], {
cwd: backendRoot,
stdio: "inherit",
shell: false,
env: process.env,
});
if (result.status !== 0) {
process.exit(result.status ?? 1);
}