Skip to content

Commit

Permalink
fix(gen)!: Fix misc generated files and imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Blckbrry-Pi committed Mar 6, 2024
1 parent 0668bde commit cdf58ae
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/build/entrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export async function generateEntrypoint(project: Project, opts: BuildOpts) {
if (opts.dbDriver == DbDriver.NodePostgres) {
imports += `
// Import Prisma adapter for Postgres
import pg from "https://esm.sh/pg@^8.11.3";
import { PrismaPg } from "https://esm.sh/@prisma/adapter-pg@^5.9.1";
import pg from "npm:pg@^8.11.3";
import { PrismaPg } from "npm:@prisma/adapter-pg@^5.9.1";
`;
} else if (opts.dbDriver == DbDriver.NeonServerless) {
imports += `
Expand Down
22 changes: 11 additions & 11 deletions src/build/gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ export async function compileModuleHelper(
let dbImports = "";
if (module.db) {
dbImports = dedent`
import prisma from "./prisma/esm.js";
export { prisma };
export const Prisma = prisma.Prisma;
`;
import prisma from "./prisma/esm.js";
export { prisma };
export const Prisma = prisma.Prisma;
`;
}

const source = dedent`
import { ModuleContext as ModuleContextInner } from "${runtimePath}";
import { ${module.name}$$Registry as RegistryTypeInner } from "./registry.d.ts";
import { Registry as RegistryTypeInner } from "./registry.d.ts";
${dbImports}
export { RuntimeError } from "${runtimePath}";
export type ModuleContext = ModuleContextInner<RegistryTypeInner, ${
module.db ? "prisma.PrismaClient" : "undefined"
}};
module.db ? "prisma.PrismaClient" : "undefined"
}>;
`;

// Write source
Expand All @@ -62,8 +62,8 @@ export async function compileTestHelper(
export * from "./mod.ts";
export type TestContext = TestContextInner<RegistryTypeInner, ${
module.db ? "module.prisma.PrismaClient" : "undefined"
}};
module.db ? "module.prisma.PrismaClient" : "undefined"
}>;
export type TestFn = (ctx: TestContext) => Promise<void>;
Expand Down Expand Up @@ -96,8 +96,8 @@ export async function compileScriptHelper(
export * from "../mod.ts";
export type ScriptContext = ScriptContextInner<RegistryTypeInner, ${
module.db ? "module.prisma.PrismaClient" : "undefined"
}};
module.db ? "module.prisma.PrismaClient" : "undefined"
}>;
`;

// Write source
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export {
Transaction,
} from "https://deno.land/x/[email protected]/mod.ts";

import Ajv from "https://esm.sh/ajv@^8.12.0";
import * as Ajv from "https://esm.sh/ajv@^8.12.0";
export { Ajv };

import addFormats from "https://esm.sh/ajv-formats@^2.1.1";
Expand Down

0 comments on commit cdf58ae

Please sign in to comment.