* 向上查找 monorepo 根目录(包含 pnpm-workspace.yaml 或根 node_modules)
(startDir)
| 16 | function generatePrismaClient() { |
| 17 | const packageRequire = createRequire(join(packageRoot, 'package.json')); |
| 18 | const prismaCliPath = packageRequire.resolve('prisma/build/index.js'); |
| 19 | const schemaPath = join(packageRoot, 'prisma', 'schema.prisma'); |
| 20 | |
| 21 | console.log(`[postinstall] 在包目录中生成 Prisma Client: ${packageRoot}`); |
| 22 | execFileSync( |
| 23 | process.execPath, |
| 24 | [prismaCliPath, 'generate', '--schema', schemaPath], |
| 25 | { |
| 26 | cwd: packageRoot, |
| 27 | env: { |
| 28 | ...process.env, |
| 29 | INIT_CWD: packageRoot, |
| 30 | PWD: packageRoot, |
| 31 | }, |
| 32 | stdio: 'inherit', |
| 33 | }, |
| 34 | ); |
| 35 | } |
no test coverage detected