@tsed/prisma
Version:
Generate Ts.ED JsonSchema based on Prisma models
30 lines • 1.02 kB
JavaScript
import path from "node:path";
import { ModuleDeclarationKind, StructureKind } from "ts-morph";
import { resolveExtension } from "./resolveExtension.js";
export function generateInterfaces(project, baseDirPath) {
const directory = project.createDirectory(path.resolve(baseDirPath, "interfaces"));
const indexFile = directory.createSourceFile("index.ts", undefined, { overwrite: true });
indexFile.addImportDeclaration({
kind: StructureKind.ImportDeclaration,
moduleSpecifier: resolveExtension("../client/index"),
namedImports: ["Prisma"]
});
indexFile
.addModule({
name: "",
hasDeclareKeyword: true,
declarationKind: ModuleDeclarationKind.Global
})
.addModule({
name: "TsED"
})
.addInterface({
name: "Configuration"
})
.addProperty({
name: "prisma",
hasQuestionToken: true,
type: "Prisma.PrismaClientOptions"
});
}
//# sourceMappingURL=generateInterfaces.js.map