samchon.github
samchon.github
PPrisma
Created by samchon.github on 5/8/2025 in #help-and-questions
How to compile or get client generation result in memory?
const schema = await fs.promises.readFile("schema.prisma", "utf8");
const document = await getDMMF({ datamodel: schema });
const result = await compile(dmmf);

if (result.success === true)
console.log(result.files); // maybe Record<string, string>
else
console.log(result.diagnostics); // compilation errors
const schema = await fs.promises.readFile("schema.prisma", "utf8");
const document = await getDMMF({ datamodel: schema });
const result = await compile(dmmf);

if (result.success === true)
console.log(result.files); // maybe Record<string, string>
else
console.log(result.diagnostics); // compilation errors
I'm making an AI chatbot that automating backend development from conversation context, and the AI chatbot is generating prisma based TS backend server. To accomplish the mission, I need to compile prisma schema file in memory, so that get list of generated TS files as string values, or get compilation error messages. If AI makes invalid prisma schema file, the compilation error messages would make the AI agent to correct at the next trial, and otherwise suceeded to compile so that generates client TS files, it would be utilized for the next step (backend TS code generation). So, can you help me to compile prisma schema content only in the memory?
4 replies