From 078c94bcc09761cca52445ba85ab9d7efd45fca8 Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Wed, 24 Jun 2026 16:58:43 +0530 Subject: [PATCH 1/2] fix: limit bun flag to prisma init --- apps/blog/source.config.ts | 4 +- .../docs/guides/deployment/bun-workspaces.mdx | 44 +++++++++---------- .../content/docs/guides/frameworks/elysia.mdx | 34 +++++++------- .../docs/content/docs/guides/runtimes/bun.mdx | 28 ++++++------ .../orm/reference/prisma-config-reference.mdx | 8 ++-- .../v6/reference/prisma-config-reference.mdx | 8 ++-- .../content/docs/orm/v6/tools/prisma-cli.mdx | 4 +- apps/docs/source.config.ts | 4 +- apps/eclipse/source.config.ts | 4 +- apps/site/source.config.ts | 4 +- 10 files changed, 75 insertions(+), 67 deletions(-) diff --git a/apps/blog/source.config.ts b/apps/blog/source.config.ts index fc0a442671..c8b9ae7b70 100644 --- a/apps/blog/source.config.ts +++ b/apps/blog/source.config.ts @@ -66,7 +66,9 @@ export default defineConfig({ command: (cmd: string) => { const converted = convert(cmd.replace(/^npm init -y$/, "npm init"), "bun"); if (!converted) return undefined; - return converted.replace(/^bun x /, "bunx --bun "); + return converted + .replace(/^bun x (prisma(?:@\S+)? init\b)/gm, "bunx --bun $1") + .replace(/^bun x /gm, "bunx "); }, name: "bun", }, diff --git a/apps/docs/content/docs/guides/deployment/bun-workspaces.mdx b/apps/docs/content/docs/guides/deployment/bun-workspaces.mdx index 948f57237b..1d8faa0b50 100644 --- a/apps/docs/content/docs/guides/deployment/bun-workspaces.mdx +++ b/apps/docs/content/docs/guides/deployment/bun-workspaces.mdx @@ -20,10 +20,10 @@ This guide shows you how to use Prisma ORM in a [Bun Workspaces](https://bun.sh/ Before integrating Prisma ORM, you need to set up your project structure. Start by creating a new directory for your project (for example, `my-monorepo`) and initialize a Node.js project: -```bash +```npm mkdir my-monorepo cd my-monorepo -bun init -y +npm init ``` Next, add the `workspaces` array to your root `package.json` to define your workspace structure: @@ -50,16 +50,16 @@ This section covers creating a standalone database package that uses Prisma ORM. Navigate to the `packages/database` directory and initialize a new package: -```bash +```npm cd packages/database -bun init +npm init ``` Install the required Prisma ORM packages and other dependencies: -```bash -bun add -d prisma typescript tsx @types/node @types/pg -bun add @prisma/client @prisma/adapter-pg pg +```npm +npm install prisma typescript tsx @types/node @types/pg --save-dev +npm install @prisma/client @prisma/adapter-pg pg ``` :::info @@ -72,8 +72,8 @@ If you are using a different database provider (MySQL, SQL Server, SQLite), inst Initialize Prisma ORM with an instance of [Prisma Postgres](/postgres) in the `database` package by running the following command: -```bash -bunx --bun prisma init +```npm +npx prisma init ``` :::info @@ -91,7 +91,7 @@ This command: Create a Prisma Postgres database and replace the generated `DATABASE_URL` in your `.env` file with the `postgres://...` connection string from the CLI output: -```bash +```npm npx create-db ``` @@ -116,8 +116,8 @@ model User { // [!code ++] If the generated `prisma.config.ts` comments mention installing `dotenv`, install it so environment variables load: -```bash -bun add dotenv +```npm +npm install dotenv ``` Add a `scripts` section to your database `package.json` (Bun init may not add one by default): @@ -136,14 +136,14 @@ Add a `scripts` section to your database `package.json` (Bun init may not add on Use [Prisma Migrate](/orm/prisma-migrate) to migrate your database changes: -```bash -bun run db:migrate +```npm +npm run db:migrate ``` When prompted by the CLI, enter a descriptive name for your migration. After the migration completes, run generate so the Prisma ORM client is created: -```bash -bun run db:generate +```npm +npm run db:generate ``` Create a `client.ts` file to initialize the Prisma ORM client with a driver adapter: @@ -257,8 +257,8 @@ cd ../../apps Create a new Next.js app named `web`: -```bash -bun create next-app@latest web --yes +```npm +npm create next-app@latest web -- --yes ``` :::note[important] @@ -291,8 +291,8 @@ Open the `package.json` file of your Next.js app and add the shared `database` p Run the following command to install the `database` package: -```bash -bun install +```npm +npm install ``` ### 3.2. Add database to app @@ -330,8 +330,8 @@ cd ../../ Start your development server by executing: -```bash -bun run dev +```npm +npm run dev ``` Open your browser at [`http://localhost:3000`](http://localhost:3000) to see your app in action. You can run `bun run studio` to open [Prisma Studio](/studio) at [`http://localhost:5555`](http://localhost:5555) to view and edit your data. diff --git a/apps/docs/content/docs/guides/frameworks/elysia.mdx b/apps/docs/content/docs/guides/frameworks/elysia.mdx index a1556954df..401251756e 100644 --- a/apps/docs/content/docs/guides/frameworks/elysia.mdx +++ b/apps/docs/content/docs/guides/frameworks/elysia.mdx @@ -29,10 +29,10 @@ Or follow the steps below to set it up manually. ## 1. Set up your project -Create a new Elysia project using the Bun scaffolding command: +Create a new Elysia project: -```bash -bun create elysia elysia-prisma +```npm +npm create elysia@latest elysia-prisma ``` Navigate to the project directory: @@ -47,9 +47,9 @@ cd elysia-prisma Install the required Prisma packages, database adapter, and Prismabox (for generated TypeBox schemas): -```bash -bun add -d prisma bun-types -bun add @prisma/client @prisma/adapter-pg pg prismabox +```npm +npm install prisma bun-types --save-dev +npm install @prisma/client @prisma/adapter-pg pg prismabox ``` :::info @@ -60,8 +60,8 @@ If you are using a different database provider (MySQL, SQL Server, SQLite), inst Once installed, initialize Prisma in your project: -```bash -bunx --bun prisma init --output ../src/generated/prisma +```npm +npx prisma init --output ../src/generated/prisma ``` :::info @@ -125,9 +125,9 @@ This matches the Prisma Elysia example: it generates Prisma Client to `src/gener Run the following commands to create the database tables and generate the Prisma Client: -```bash -bunx --bun prisma migrate dev --name init -bunx --bun prisma generate +```npm +npx prisma migrate dev --name init +npx prisma generate ``` ### 2.4. Seed the database @@ -177,14 +177,14 @@ main() Run the seed script: -```bash -bunx --bun prisma db seed +```npm +npx prisma db seed ``` And open Prisma Studio to inspect your data: -```bash -bunx --bun prisma studio +```npm +npx prisma studio ``` ## 3. Integrate Prisma into Elysia @@ -406,8 +406,8 @@ Prismabox generates the `TodoPlain`/`TodoPlainInput*` TypeBox schemas so respons Start your Elysia server: -```bash -bun run dev +```npm +npm run dev ``` You should see `🦊 Elysia is running at localhost:3000` in the console. diff --git a/apps/docs/content/docs/guides/runtimes/bun.mdx b/apps/docs/content/docs/guides/runtimes/bun.mdx index 52a1c396fa..ef06b97470 100644 --- a/apps/docs/content/docs/guides/runtimes/bun.mdx +++ b/apps/docs/content/docs/guides/runtimes/bun.mdx @@ -30,8 +30,8 @@ cd bun-prisma Then, initialise a new Bun project: -```bash -bun init -y +```npm +npm init ``` This creates a basic Bun project that includes a `package.json` file and an `index.ts` file. @@ -42,9 +42,9 @@ This creates a basic Bun project that includes a `package.json` file and an `ind Install the required Prisma packages and other dependencies: -```bash -bun add -d prisma @types/pg -bun add @prisma/client @prisma/adapter-pg pg +```npm +npm install prisma @types/pg --save-dev +npm install @prisma/client @prisma/adapter-pg pg ``` :::info @@ -57,13 +57,13 @@ If you are using a different database provider (MySQL, SQL Server, SQLite), inst Initialize Prisma ORM with Prisma Postgres in your project: -```bash -bunx --bun prisma init +```npm +npx prisma init ``` :::note -The `--bun` flag is required to ensure Prisma runs with the Bun runtime. Without it, Prisma falls back to Node.js due to the `#!/usr/bin/env node` shebang in the CLI. +When using the Bun tab for `prisma init`, the `--bun` flag ensures Prisma runs with the Bun runtime instead of falling back to Node.js due to the `#!/usr/bin/env node` shebang in the CLI. ::: @@ -83,7 +83,7 @@ This command creates: Create a Prisma Postgres database and replace the generated `DATABASE_URL` in your `.env` file with the `postgres://...` connection string from the CLI output: -```bash +```npm npx create-db ``` @@ -118,9 +118,9 @@ model User { // [!code ++] Generate the Prisma client and apply your schema to the database: -```bash -bunx --bun prisma migrate dev --name init -bunx --bun prisma generate +```npm +npx prisma migrate dev --name init +npx prisma generate ``` This command: @@ -221,8 +221,8 @@ Unlike Node.js, Bun automatically loads `.env` files, so the `import 'dotenv/con Run the seed script to populate your database: -```bash -bunx --bun prisma db seed +```npm +npx prisma db seed ``` ## 5. Creating your Bun server diff --git a/apps/docs/content/docs/orm/reference/prisma-config-reference.mdx b/apps/docs/content/docs/orm/reference/prisma-config-reference.mdx index 158db523e8..116379d6cd 100644 --- a/apps/docs/content/docs/orm/reference/prisma-config-reference.mdx +++ b/apps/docs/content/docs/orm/reference/prisma-config-reference.mdx @@ -550,7 +550,7 @@ For Bun, `.env` files are automatically loaded without additional configuration. :::note -When running Prisma CLI commands with Bun, use the `--bun` flag (e.g., `bunx --bun prisma init`) to ensure Prisma uses the Bun runtime instead of falling back to Node.js. +When running `prisma init` with Bun, use the `--bun` flag (for example, `bunx --bun prisma init`) to ensure Prisma uses the Bun runtime instead of falling back to Node.js. ::: @@ -682,13 +682,13 @@ pnpm prisma validate # → Still finds prisma.config.ts and resolves schema correctly ``` -### Behavior with `npx prisma` or `bunx --bun prisma` +### Behavior with `npx prisma` or `bunx prisma` -When running via `npx prisma` or `bunx --bun prisma`, the CLI only detects the config file if the command is run from the **project root** (where `package.json` declares Prisma). +When running via `npx prisma` or `bunx prisma`, the CLI only detects the config file if the command is run from the **project root** (where `package.json` declares Prisma). :::note -The `--bun` flag is required when using Bun to ensure Prisma runs with the Bun runtime. Without it, Prisma falls back to Node.js due to the `#!/usr/bin/env node` shebang in the CLI. +When running `prisma init` with Bun, use `bunx --bun prisma init` to ensure Prisma runs with the Bun runtime. ::: diff --git a/apps/docs/content/docs/orm/v6/reference/prisma-config-reference.mdx b/apps/docs/content/docs/orm/v6/reference/prisma-config-reference.mdx index 8ca9cbb4a9..606043bf50 100644 --- a/apps/docs/content/docs/orm/v6/reference/prisma-config-reference.mdx +++ b/apps/docs/content/docs/orm/v6/reference/prisma-config-reference.mdx @@ -606,7 +606,7 @@ For Bun, `.env` files are automatically loaded without additional configuration. :::note -When running Prisma CLI commands with Bun, use the `--bun` flag (e.g., `bunx --bun prisma init`) to ensure Prisma uses the Bun runtime instead of falling back to Node.js. +When running `prisma init` with Bun, use the `--bun` flag (for example, `bunx --bun prisma init`) to ensure Prisma uses the Bun runtime instead of falling back to Node.js. ::: @@ -738,13 +738,13 @@ pnpm prisma validate # → Still finds prisma.config.ts and resolves schema correctly ``` -### Behavior with `npx prisma` or `bunx --bun prisma` +### Behavior with `npx prisma` or `bunx prisma` -When running via `npx prisma` or `bunx --bun prisma`, the CLI only detects the config file if the command is run from the **project root** (where `package.json` declares Prisma). +When running via `npx prisma` or `bunx prisma`, the CLI only detects the config file if the command is run from the **project root** (where `package.json` declares Prisma). :::note -The `--bun` flag is required when using Bun to ensure Prisma runs with the Bun runtime. Without it, Prisma falls back to Node.js due to the `#!/usr/bin/env node` shebang in the CLI. +When running `prisma init` with Bun, use `bunx --bun prisma init` to ensure Prisma runs with the Bun runtime. ::: diff --git a/apps/docs/content/docs/orm/v6/tools/prisma-cli.mdx b/apps/docs/content/docs/orm/v6/tools/prisma-cli.mdx index a0d95a720d..d37c92320a 100644 --- a/apps/docs/content/docs/orm/v6/tools/prisma-cli.mdx +++ b/apps/docs/content/docs/orm/v6/tools/prisma-cli.mdx @@ -73,12 +73,12 @@ pnpm dlx prisma ### Bun ``` -bunx --bun prisma +bunx prisma ``` :::note -The `--bun` flag ensures Prisma runs with the Bun runtime. Without it, Prisma falls back to Node.js due to the `#!/usr/bin/env node` shebang in the CLI. +When running `prisma init` with Bun, use `bunx --bun prisma init` to ensure Prisma runs with the Bun runtime. ::: diff --git a/apps/docs/source.config.ts b/apps/docs/source.config.ts index ad8ecf3089..eb514ccfa6 100644 --- a/apps/docs/source.config.ts +++ b/apps/docs/source.config.ts @@ -96,7 +96,9 @@ export default defineConfig({ command: (cmd: string) => { const converted = convertLine(cmd, "bun"); if (!converted) return undefined; - return converted.replace(/^bun x /gm, "bunx --bun "); + return converted + .replace(/^bun x (prisma(?:@\S+)? init\b)/gm, "bunx --bun $1") + .replace(/^bun x /gm, "bunx "); }, name: "bun", }, diff --git a/apps/eclipse/source.config.ts b/apps/eclipse/source.config.ts index a479e928cf..27b18e03e2 100644 --- a/apps/eclipse/source.config.ts +++ b/apps/eclipse/source.config.ts @@ -36,7 +36,9 @@ export default defineConfig({ command: (cmd: string) => { const converted = convert(cmd.replace(/^npm init -y$/, "npm init"), "bun"); if (!converted) return undefined; - return converted.replace(/^bun x /, "bunx --bun "); + return converted + .replace(/^bun x (prisma(?:@\S+)? init\b)/gm, "bunx --bun $1") + .replace(/^bun x /gm, "bunx "); }, name: "bun", }, diff --git a/apps/site/source.config.ts b/apps/site/source.config.ts index 3aa9c5ed0a..24d1ade5bb 100644 --- a/apps/site/source.config.ts +++ b/apps/site/source.config.ts @@ -39,7 +39,9 @@ export default defineConfig({ command: (cmd: string) => { const converted = convert(cmd.replace(/^npm init -y$/, "npm init"), "bun"); if (!converted) return undefined; - return converted.replace(/^bun x /, "bunx --bun "); + return converted + .replace(/^bun x (prisma(?:@\S+)? init\b)/gm, "bunx --bun $1") + .replace(/^bun x /gm, "bunx "); }, name: "bun", }, From 4d88dc5284e698eaa187f1fdaf7b1e90e1085f8f Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Wed, 24 Jun 2026 17:26:34 +0530 Subject: [PATCH 2/2] docs: use bun create for next app setup --- apps/docs/content/docs/guides/deployment/bun-workspaces.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/docs/content/docs/guides/deployment/bun-workspaces.mdx b/apps/docs/content/docs/guides/deployment/bun-workspaces.mdx index 1d8faa0b50..867f89bff5 100644 --- a/apps/docs/content/docs/guides/deployment/bun-workspaces.mdx +++ b/apps/docs/content/docs/guides/deployment/bun-workspaces.mdx @@ -257,8 +257,8 @@ cd ../../apps Create a new Next.js app named `web`: -```npm -npm create next-app@latest web -- --yes +```bash +bun create next-app@latest web --yes ``` :::note[important]