Skip to content

Commit 1e80d9e

Browse files
committed
carrot
1 parent 3cd7dd8 commit 1e80d9e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

packages/build/src/extensions/prisma.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { BuildManifest, BuildTarget } from "@trigger.dev/core/v3";
22
import { binaryForRuntime, BuildContext, BuildExtension } from "@trigger.dev/core/v3/build";
3+
import { readFileSync } from "node:fs";
34
import assert from "node:assert";
45
import { existsSync } from "node:fs";
56
import { cp, readdir } from "node:fs/promises";
@@ -85,6 +86,27 @@ export class PrismaExtension implements BuildExtension {
8586
`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}`
8687
);
8788
}
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+
}
88110
}
89111

90112
async onBuildComplete(context: BuildContext, manifest: BuildManifest) {
@@ -114,6 +136,11 @@ export class PrismaExtension implements BuildExtension {
114136

115137
const usingSchemaFolder = dirname(this._resolvedSchemaPath).endsWith("schema");
116138

139+
context.logger.debug(`Schema folder detection`, {
140+
usingSchemaFolder,
141+
schemaPath: this._resolvedSchemaPath,
142+
});
143+
117144
const commands: string[] = [];
118145

119146
let prismaDir: string | undefined;

0 commit comments

Comments
 (0)