This commit is contained in:
2026-10-29 13:21:30 +06:00
parent 2ae9f84ddf
commit 3acc0de8de
132 changed files with 35007 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
#!/usr/bin/env node
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
const rootDir = path.resolve(__dirname, '..');
const backendDir = path.join(rootDir, 'apps', 'backend');
const dotPrismaClientPath = path.join(rootDir, 'node_modules', '.prisma', 'client', 'index.d.ts');
try {
const npxCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
execSync(`${npxCmd} prisma generate`, {
cwd: backendDir,
stdio: 'inherit',
shell: true,
});
} catch (err) {
// Check if client is already generated
let isClientValid = false;
if (fs.existsSync(dotPrismaClientPath)) {
try {
const content = fs.readFileSync(dotPrismaClientPath, 'utf8');
if (content.includes('Model User') && content.includes('Model FileAsset')) {
isClientValid = true;
}
} catch {
// ignore
}
}
if (isClientValid) {
console.warn('\n⚠️ [Prisma Generator] A running Node.js process is currently holding the Prisma query engine DLL.');
console.warn(' Existing generated Prisma Client is valid and intact. Proceeding safely.\n');
process.exit(0);
} else {
console.error('\n❌ [Prisma Generator Error] Failed to generate Prisma Client:', err.message);
if (process.platform === 'win32') {
console.error(' Hint: A running Node process may have locked the query engine DLL.');
console.error(' Run "npm run stop" or close active server windows, then rebuild.\n');
}
process.exit(1);
}
}