Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add no-engine flag #77

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ interface ModuleOptions extends Prisma.PrismaClientOptions {
skipPrompts: boolean;
prismaRoot?: string;
prismaSchemaPath?: string;
noEngine?: boolean;
}

export type PrismaExtendedModule = ModuleOptions;
Expand Down Expand Up @@ -70,6 +71,7 @@ export default defineNuxtModule<PrismaExtendedModule>({
skipPrompts: false,
prismaRoot: undefined,
prismaSchemaPath: undefined,
noEngine: false,
},

async setup(options, nuxt) {
Expand All @@ -85,6 +87,8 @@ export default defineNuxtModule<PrismaExtendedModule>({
? ["--schema", options.prismaSchemaPath]
: [];

const PRISMA_NO_ENGINE_CMD = options.noEngine ? ["--no-engine"] : [];

/**
* Helper function to prepare the module configuration
*/
Expand Down Expand Up @@ -146,6 +150,7 @@ export default defineNuxtModule<PrismaExtendedModule>({
await generatePrismaClient(
PROJECT_PATH,
PRISMA_SCHEMA_CMD,
PRISMA_NO_ENGINE_CMD,
options.log?.includes("error"),
);
}
Expand Down Expand Up @@ -246,6 +251,7 @@ export default defineNuxtModule<PrismaExtendedModule>({
await generatePrismaClient(
PROJECT_PATH,
PRISMA_SCHEMA_CMD,
PRISMA_NO_ENGINE_CMD,
options.log?.includes("error"),
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/package-utils/setup-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,13 @@ export async function installPrismaClient(
export async function generatePrismaClient(
directory: string,
prismaSchemaPath: string[],
noEngine: string[],
verboseLog: boolean = false,
) {
try {
const { stdout: generateClient } = await execa(
"npx",
["prisma", "generate"].concat(prismaSchemaPath),
["prisma", "generate"].concat(prismaSchemaPath).concat(noEngine),
{ cwd: directory },
);

Expand Down
Loading