|
1 | 1 | import { BuildManifest, BuildTarget } from "@trigger.dev/core/v3";
|
2 | 2 | import { binaryForRuntime, BuildContext, BuildExtension } from "@trigger.dev/core/v3/build";
|
| 3 | +import { readFileSync } from "node:fs"; |
3 | 4 | import assert from "node:assert";
|
4 | 5 | import { existsSync } from "node:fs";
|
5 | 6 | import { cp, readdir } from "node:fs/promises";
|
@@ -85,6 +86,27 @@ export class PrismaExtension implements BuildExtension {
|
85 | 86 | `PrismaExtension could not find the prisma schema at ${this._resolvedSchemaPath}. Make sure the path is correct: ${this.options.schema}, relative to the working dir ${context.workingDir}`
|
86 | 87 | );
|
87 | 88 | }
|
| 89 | + |
| 90 | + // --- Additional diagnostics for Prisma 6.6+ support --- |
| 91 | + try { |
| 92 | + const schemaContents = readFileSync(this._resolvedSchemaPath, "utf-8"); |
| 93 | + const generatorBlocks = [...schemaContents.matchAll(/generator\s+(\w+)\s+\{([\s\S]*?)\}/g)].map((m) => { |
| 94 | + const body = (m[2] ?? "") as string; |
| 95 | + const provider = body.match(/provider\s*=\s*["']([^"']+)["']/)?.[1]; |
| 96 | + const output = body.match(/output\s*=\s*["']([^"']+)["']/)?.[1]; |
| 97 | + return { |
| 98 | + name: m[1], |
| 99 | + provider, |
| 100 | + output, |
| 101 | + }; |
| 102 | + }); |
| 103 | + |
| 104 | + context.logger.debug(`Prisma generators detected`, { |
| 105 | + generators: generatorBlocks, |
| 106 | + }); |
| 107 | + } catch (err) { |
| 108 | + context.logger.warn(`Failed to parse generators from prisma schema: ${(err as Error).message}`); |
| 109 | + } |
88 | 110 | }
|
89 | 111 |
|
90 | 112 | async onBuildComplete(context: BuildContext, manifest: BuildManifest) {
|
@@ -114,6 +136,11 @@ export class PrismaExtension implements BuildExtension {
|
114 | 136 |
|
115 | 137 | const usingSchemaFolder = dirname(this._resolvedSchemaPath).endsWith("schema");
|
116 | 138 |
|
| 139 | + context.logger.debug(`Schema folder detection`, { |
| 140 | + usingSchemaFolder, |
| 141 | + schemaPath: this._resolvedSchemaPath, |
| 142 | + }); |
| 143 | + |
117 | 144 | const commands: string[] = [];
|
118 | 145 |
|
119 | 146 | let prismaDir: string | undefined;
|
|
0 commit comments