Prisma Plugin
Regenerates the Prisma client whenever schema.prisma changes, so you never have to remember to run prisma generate by hand.
Installation
- yarn
- npm
- pnpm
- bun
yarn add @baeta/plugin-prisma -D
npm install @baeta/plugin-prisma -D
pnpm add @baeta/plugin-prisma -D
bun add @baeta/plugin-prisma -D
Configuration
In baeta.ts:
baeta.ts
import { defineConfig } from "@baeta/cli";
import { prismaPlugin } from "@baeta/plugin-prisma";
export default defineConfig({
// ... other config
plugins: [
prismaPlugin({
prismaSchema: "schema.prisma",
generatedSchemaPath: "src/__generated__/prisma/schema.prisma", // OR node_modules/@prisma/client/schema.prisma
generateCommand: "prisma generate", // this is the default value
}),
],
});
For the full configuration interface, see the PrismaPluginOptions API reference.
tip
To regenerate the client and push schema changes to the database in one step, set generateCommand: "prisma db push".
How it works
On every run, the plugin:
- Watches
prismaSchemafor changes. - Runs
generateCommandwhen it sees one. - Writes the result to the configured path.