@prisma/cli 3.0.0-dev.39.1 → 3.0.0-dev.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,13 +62,13 @@ function createDeployCommand(runtime) {
62
62
  command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name")).addOption(new Option("--create-project <name>", "Create and link a new Project before deploying")).addOption(new Option("--branch <name>", "Branch name")).addOption(new Option("--framework <name>", "Framework to deploy").choices([
63
63
  "nextjs",
64
64
  "hono",
65
- "tanstack-start"
66
- ])).addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto deploys")).addOption(new Option("--build-type <type>", "Legacy deploy build type").choices([...PREVIEW_BUILD_TYPES]).default("auto").hideHelp()).addOption(new Option("--http-port <port>", "HTTP port override for the deployed app")).addOption(new Option("--env <name=value>", "Environment variable").argParser(collectRepeatableValues));
65
+ "tanstack-start",
66
+ "bun"
67
+ ])).addOption(new Option("--entry <path>", "Entrypoint path for Bun deploys")).addOption(new Option("--http-port <port>", "HTTP port override for the deployed app")).addOption(new Option("--env <name=value>", "Environment variable").argParser(collectRepeatableValues));
67
68
  addGlobalFlags(command);
68
69
  command.action(async (options) => {
69
70
  const appName = options.app;
70
71
  const entry = options.entry;
71
- const buildType = options.buildType;
72
72
  const branchName = options.branch;
73
73
  const framework = options.framework;
74
74
  const httpPort = options.httpPort;
@@ -80,7 +80,6 @@ function createDeployCommand(runtime) {
80
80
  createProjectName,
81
81
  branchName,
82
82
  entrypoint: entry,
83
- buildType,
84
83
  framework,
85
84
  httpPort,
86
85
  envAssignments
@@ -9,7 +9,7 @@ import { requireComputeAuth } from "../lib/auth/guard.js";
9
9
  import { readAuthState } from "../lib/auth/auth-ops.js";
10
10
  import { parseEnvAssignments } from "../lib/app/env-vars.js";
11
11
  import { renderDeployOutputRows } from "../lib/app/deploy-output.js";
12
- import { readBunPackageJson } from "../lib/app/bun-project.js";
12
+ import { readBunPackageEntrypoint, readBunPackageJson } from "../lib/app/bun-project.js";
13
13
  import { DEFAULT_LOCAL_DEV_PORT, resolveLocalBuildType, runLocalApp } from "../lib/app/local-dev.js";
14
14
  import { inferTargetName, projectNotFoundError, resolveDurablePlatformMapping, resolveProjectTarget, sortProjects } from "../lib/project/resolution.js";
15
15
  import { LOCAL_RESOLUTION_PIN_RELATIVE_PATH, readLocalResolutionPin } from "../lib/project/local-pin.js";
@@ -29,8 +29,10 @@ import open from "open";
29
29
  const DEPLOY_FRAMEWORKS = [
30
30
  "nextjs",
31
31
  "hono",
32
- "tanstack-start"
32
+ "tanstack-start",
33
+ "bun"
33
34
  ];
35
+ const TANSTACK_START_PACKAGES = ["@tanstack/react-start", "@tanstack/solid-start"];
34
36
  const FRAMEWORK_DEFAULT_HTTP_PORT = 3e3;
35
37
  const PRISMA_PROJECT_ID_ENV_VAR = "PRISMA_PROJECT_ID";
36
38
  const PRISMA_APP_ID_ENV_VAR = "PRISMA_APP_ID";
@@ -105,15 +107,12 @@ async function runAppDeploy(context, appName, options) {
105
107
  const skipLocalPin = Boolean(envProjectId || options?.projectRef || options?.createProjectName);
106
108
  const localPin = skipLocalPin ? { kind: "missing" } : await readLocalResolutionPin(context.runtime.cwd);
107
109
  if (!skipLocalPin && localPin.kind === "invalid") throw localResolutionPinStaleError();
108
- const explicitBuildType = Boolean(options?.buildType && options.buildType !== "auto");
110
+ const branch = await resolveDeployBranch(context, options?.branchName);
109
111
  if (options?.httpPort) parseDeployHttpPort(options.httpPort);
110
112
  assertSupportedEntrypointForRequestedDeployShape({
111
113
  requestedFramework: options?.framework,
112
- requestedBuildType: options?.buildType,
113
- explicitBuildType,
114
114
  entrypoint: options?.entrypoint
115
115
  });
116
- const branch = await resolveDeployBranch(context, options?.branchName);
117
116
  const { provider, target, projectId } = await requireProviderAndDeployProjectContext(context, options?.projectRef, {
118
117
  branch,
119
118
  createProjectName: options?.createProjectName,
@@ -128,8 +127,7 @@ async function runAppDeploy(context, appName, options) {
128
127
  }
129
128
  let framework = await resolveDeployFramework(context, {
130
129
  requestedFramework: options?.framework,
131
- requestedBuildType: options?.buildType,
132
- explicitBuildType
130
+ entrypoint: options?.entrypoint
133
131
  });
134
132
  let runtime = resolveDeployRuntime(options?.httpPort, framework);
135
133
  assertSupportedEntrypoint(framework.buildType, options?.entrypoint, "deploy");
@@ -151,13 +149,14 @@ async function runAppDeploy(context, appName, options) {
151
149
  runtime,
152
150
  firstDeploy: selectedApp.firstDeploy,
153
151
  explicitFramework: Boolean(options?.framework),
154
- explicitBuildType,
152
+ explicitEntrypoint: Boolean(options?.entrypoint),
155
153
  explicitHttpPort: Boolean(options?.httpPort)
156
154
  });
157
155
  framework = customized.framework;
158
156
  runtime = customized.runtime;
159
157
  const buildType = framework.buildType;
160
158
  assertSupportedEntrypoint(buildType, options?.entrypoint, "deploy");
159
+ const entrypoint = await resolveDeployEntrypoint(context.runtime.cwd, framework, options?.entrypoint);
161
160
  const portMapping = parseDeployPortMapping(String(runtime.port));
162
161
  const progressState = createPreviewDeployProgressState();
163
162
  const deployStartedAt = Date.now();
@@ -168,7 +167,7 @@ async function runAppDeploy(context, appName, options) {
168
167
  appId: selectedApp.appId,
169
168
  appName: selectedApp.appName,
170
169
  region: selectedApp.region,
171
- entrypoint: options?.entrypoint,
170
+ entrypoint,
172
171
  buildType,
173
172
  portMapping,
174
173
  envVars,
@@ -718,7 +717,7 @@ async function resolveAppDomainTarget(context, options) {
718
717
  });
719
718
  const envProjectId = readDeployEnvOverride(context, PRISMA_PROJECT_ID_ENV_VAR);
720
719
  const envAppId = readDeployEnvOverride(context, PRISMA_APP_ID_ENV_VAR);
721
- const skipLocalPin = Boolean(envProjectId);
720
+ const skipLocalPin = Boolean(envProjectId || options?.projectRef);
722
721
  const localPin = skipLocalPin ? { kind: "missing" } : await readLocalResolutionPin(context.runtime.cwd);
723
722
  if (!skipLocalPin && localPin.kind === "invalid") throw localResolutionPinStaleError();
724
723
  const { provider, target, projectId } = await requireProviderAndDeployProjectContext(context, options?.projectRef, {
@@ -1505,15 +1504,12 @@ async function resolveGitHeadPath(gitPath) {
1505
1504
  }
1506
1505
  async function resolveDeployFramework(context, options) {
1507
1506
  if (options.requestedFramework) return frameworkFromUserFacingValue(options.requestedFramework, "set by --framework");
1508
- if (options.explicitBuildType) {
1509
- const buildType = normalizeBuildType(options.requestedBuildType);
1510
- if (buildType !== "auto") return {
1511
- key: buildType,
1512
- buildType,
1513
- displayName: formatBuildTypeName(buildType),
1514
- annotation: "set by --build-type"
1515
- };
1516
- }
1507
+ if (options.entrypoint) return {
1508
+ key: "bun",
1509
+ buildType: "bun",
1510
+ displayName: "Bun",
1511
+ annotation: "set by --entry"
1512
+ };
1517
1513
  const detected = await detectDeployFramework(context.runtime.cwd);
1518
1514
  if (detected) return detected;
1519
1515
  throw frameworkNotDetectedError(context.runtime.cwd);
@@ -1529,12 +1525,22 @@ function resolveDeployRuntime(requestedHttpPort, framework) {
1529
1525
  };
1530
1526
  }
1531
1527
  function assertSupportedEntrypointForRequestedDeployShape(options) {
1532
- if (options.requestedFramework) {
1533
- assertSupportedEntrypoint(frameworkFromUserFacingValue(options.requestedFramework, "set by --framework").buildType, options.entrypoint, "deploy");
1528
+ if (!options.requestedFramework) return;
1529
+ assertSupportedEntrypoint(frameworkFromUserFacingValue(options.requestedFramework, "set by --framework").buildType, options.entrypoint, "deploy");
1530
+ }
1531
+ async function resolveDeployEntrypoint(cwd, framework, explicitEntrypoint) {
1532
+ if (explicitEntrypoint || framework.buildType !== "bun") return explicitEntrypoint;
1533
+ const packageEntrypoint = readBunPackageEntrypoint(await readBunPackageJson(cwd));
1534
+ if (packageEntrypoint) return packageEntrypoint;
1535
+ if (framework.key !== "hono") return;
1536
+ const defaultEntrypoint = "src/index.ts";
1537
+ try {
1538
+ await access(path.join(cwd, defaultEntrypoint));
1539
+ return defaultEntrypoint;
1540
+ } catch (error) {
1541
+ if (error.code !== "ENOENT") throw error;
1534
1542
  return;
1535
1543
  }
1536
- if (!options.explicitBuildType) return;
1537
- assertSupportedEntrypoint(normalizeBuildType(options.requestedBuildType), options.entrypoint, "deploy");
1538
1544
  }
1539
1545
  async function detectDeployFramework(cwd) {
1540
1546
  const packageJson = await readBunPackageJson(cwd);
@@ -1551,7 +1557,7 @@ async function detectDeployFramework(cwd) {
1551
1557
  displayName: "Hono",
1552
1558
  annotation: "detected from package.json"
1553
1559
  };
1554
- if (hasPackageDependency(packageJson, "@tanstack/start")) return {
1560
+ if (hasAnyPackageDependency(packageJson, TANSTACK_START_PACKAGES)) return {
1555
1561
  key: "tanstack-start",
1556
1562
  buildType: "tanstack-start",
1557
1563
  displayName: "TanStack Start",
@@ -1564,7 +1570,8 @@ async function detectNextConfig(cwd) {
1564
1570
  "next.config.js",
1565
1571
  "next.config.mjs",
1566
1572
  "next.config.cjs",
1567
- "next.config.ts"
1573
+ "next.config.ts",
1574
+ "next.config.mts"
1568
1575
  ]) {
1569
1576
  const filePath = path.join(cwd, candidate);
1570
1577
  try {
@@ -1585,6 +1592,9 @@ async function detectNextConfig(cwd) {
1585
1592
  function hasPackageDependency(packageJson, dependencyName) {
1586
1593
  return hasDependency(packageJson?.dependencies, dependencyName) || hasDependency(packageJson?.devDependencies, dependencyName);
1587
1594
  }
1595
+ function hasAnyPackageDependency(packageJson, dependencyNames) {
1596
+ return dependencyNames.some((dependencyName) => hasPackageDependency(packageJson, dependencyName));
1597
+ }
1588
1598
  function hasDependency(dependencies, dependencyName) {
1589
1599
  return Boolean(dependencies && typeof dependencies === "object" && dependencyName in dependencies);
1590
1600
  }
@@ -1604,9 +1614,16 @@ function frameworkFromUserFacingValue(value, annotation) {
1604
1614
  displayName: "Hono",
1605
1615
  annotation
1606
1616
  };
1617
+ case "bun": return {
1618
+ key: "bun",
1619
+ buildType: "bun",
1620
+ displayName: "Bun",
1621
+ annotation
1622
+ };
1607
1623
  case "tanstack":
1608
1624
  case "tanstack-start":
1609
- case "@tanstack/start": return {
1625
+ case "@tanstack/react-start":
1626
+ case "@tanstack/solid-start": return {
1610
1627
  key: "tanstack-start",
1611
1628
  buildType: "tanstack-start",
1612
1629
  displayName: "TanStack Start",
@@ -1616,19 +1633,21 @@ function frameworkFromUserFacingValue(value, annotation) {
1616
1633
  }
1617
1634
  }
1618
1635
  function frameworkNotDetectedError(cwd, requestedFramework) {
1619
- const supported = "Next.js, Hono, TanStack Start";
1636
+ const supported = "Next.js, Hono, TanStack Start, Bun";
1620
1637
  const directory = cwd ? ` in ${formatDeployDirectory(cwd)}` : "";
1621
1638
  return new CliError({
1622
1639
  code: "FRAMEWORK_NOT_DETECTED",
1623
1640
  domain: "app",
1624
1641
  summary: requestedFramework ? `Unsupported framework "${requestedFramework}"` : `Cannot detect a supported framework${directory}`,
1625
1642
  why: `Supported Beta frameworks: ${supported}.`,
1626
- fix: "Add one of these frameworks as a dependency, or pass --framework <nextjs|hono|tanstack-start>.",
1643
+ fix: "Add one of these frameworks as a dependency, pass --framework <nextjs|hono|tanstack-start|bun>, or pass --entry <path> for a Bun app.",
1627
1644
  exitCode: 2,
1628
1645
  nextSteps: [
1629
1646
  "prisma-cli app deploy --framework nextjs",
1630
1647
  "prisma-cli app deploy --framework hono",
1631
- "prisma-cli app deploy --framework tanstack-start"
1648
+ "prisma-cli app deploy --framework tanstack-start",
1649
+ "prisma-cli app deploy --framework bun --entry server.ts",
1650
+ "prisma-cli app deploy --entry server.ts"
1632
1651
  ]
1633
1652
  });
1634
1653
  }
@@ -1643,7 +1662,7 @@ function maybeRenderProjectLinked(context, directory, projectName, localPinPath)
1643
1662
  context.output.stderr.write(`${context.ui.success("✔")} Linked "${directory}" to Project "${projectName}"\nSaved ${localPinPath}\n\n`);
1644
1663
  }
1645
1664
  async function maybeCustomizeDeploySettings(context, options) {
1646
- if (!options.firstDeploy || context.flags.yes || options.explicitFramework || options.explicitBuildType || options.explicitHttpPort || !canPrompt(context)) return {
1665
+ if (!options.firstDeploy || context.flags.yes || options.explicitFramework || options.explicitEntrypoint || options.explicitHttpPort || !canPrompt(context)) return {
1647
1666
  framework: options.framework,
1648
1667
  runtime: options.runtime
1649
1668
  };
@@ -1700,6 +1719,7 @@ function frameworkDisplayName(framework) {
1700
1719
  case "nextjs": return "Next.js";
1701
1720
  case "hono": return "Hono";
1702
1721
  case "tanstack-start": return "TanStack Start";
1722
+ case "bun": return "Bun";
1703
1723
  }
1704
1724
  }
1705
1725
  function validateDeployHttpPortText(value) {
@@ -1734,7 +1754,10 @@ function getBuildTypeExamples(commandName) {
1734
1754
  });
1735
1755
  }
1736
1756
  function assertSupportedEntrypoint(buildType, entrypoint, commandName) {
1737
- if (buildType !== "auto" && buildType !== "bun" && entrypoint) throw usageError(`App ${commandName} does not accept --entry with --build-type ${buildType}`, `${formatBuildTypeName(buildType)} apps do not use an entrypoint flag in the current preview.`, `Remove --entry, or rerun prisma-cli app ${commandName} with --build-type bun when you want to target a Bun entrypoint directly.`, [`prisma-cli app ${commandName} --build-type ${buildType}`, `prisma-cli app ${commandName} --build-type bun --entry server.ts`], "app");
1757
+ if (buildType !== "auto" && buildType !== "bun" && entrypoint) {
1758
+ if (commandName === "deploy") throw usageError(`App deploy does not accept --entry with ${formatBuildTypeName(buildType)}`, `${formatBuildTypeName(buildType)} apps derive their runtime entrypoint from build output.`, "Remove --entry, or use --framework bun when you want to target a Bun entrypoint directly.", [`prisma-cli app deploy --framework ${buildType}`, "prisma-cli app deploy --framework bun --entry server.ts"], "app");
1759
+ throw usageError(`App ${commandName} does not accept --entry with --build-type ${buildType}`, `${formatBuildTypeName(buildType)} apps do not use an entrypoint flag in the current preview.`, `Remove --entry, or rerun prisma-cli app ${commandName} with --build-type bun when you want to target a Bun entrypoint directly.`, [`prisma-cli app ${commandName} --build-type ${buildType}`, `prisma-cli app ${commandName} --build-type bun --entry server.ts`], "app");
1760
+ }
1738
1761
  }
1739
1762
  async function requireLocalBuildType(context, buildType, commandName) {
1740
1763
  const resolvedBuildType = await resolveLocalBuildType(context.runtime.cwd, buildType);
@@ -212,7 +212,8 @@ const DESCRIPTORS = [
212
212
  "prisma-cli app deploy --app my-app --env DATABASE_URL=postgresql://example",
213
213
  "prisma-cli app deploy --app my-app --framework nextjs --http-port 3000",
214
214
  "prisma-cli app deploy --branch feat-login --framework hono",
215
- "pnpm dlx skills@latest add prisma/prisma-cli/skills#cli-v<cli-version> --all"
215
+ "pnpm dlx skills@latest add prisma/prisma-cli/skills#cli-v<cli-version> --all",
216
+ "prisma-cli app deploy --framework bun --entry src/server.ts"
216
217
  ]
217
218
  },
218
219
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/cli",
3
- "version": "3.0.0-dev.39.1",
3
+ "version": "3.0.0-dev.40.1",
4
4
  "description": "Command-line interface for the Prisma Developer Platform.",
5
5
  "type": "module",
6
6
  "bin": {