You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cli): support custom compute build config (#98)
## Summary
Adds Prisma CLI support for custom Compute build config. This lets users
describe how an app should be built and staged in `prisma.compute.ts`
when the app does not fit one of the first-class framework strategies
yet.
Companion PRs:
- prisma/project-compute#97
- prisma/pdp-control-plane#4310
The SDK support has been released, so this PR depends on
`@prisma/compute-sdk@^0.29.0` and includes the lockfile update.
## What changed
- Uses the SDK framework registry for `app build --build-type` choices
instead of duplicating the list in the CLI.
- Adds `custom` to CLI build result typing.
- Passes `prisma.compute.ts` `build.entrypoint` into configured build
settings.
- Shows configured build entrypoints in deploy build-settings output.
- Reports the effective deploy entrypoint from configured build settings
when no source `--entry` is used.
- Updates config tests for `custom`, framework-owned build blocks, and
`build.entrypoint` normalization.
- Updates product docs for `build.entrypoint`, `framework: "custom"`,
and custom artifact builds.
## User-facing behavior
A custom artifact can be deployed through `prisma.compute.ts` by
providing:
- `framework: "custom"`
- `build.outputDirectory`
- `build.entrypoint`
`build.command` is optional. Omit it when the artifact is already built,
or set it when the CLI should run a build before staging the artifact.
Example single-app config:
```ts
import { defineComputeConfig } from "@prisma/compute-sdk/config";
export default defineComputeConfig({
app: {
name: "web",
framework: "custom",
httpPort: 3000,
build: {
command: "npm run build",
outputDirectory: "dist",
entrypoint: "server.js",
},
},
});
```
Users can then run:
```bash
prisma-cli app build
prisma-cli app deploy
```
Example prebuilt artifact config:
```ts
import { defineComputeConfig } from "@prisma/compute-sdk/config";
export default defineComputeConfig({
app: {
name: "web",
framework: "custom",
build: {
outputDirectory: "dist",
entrypoint: "server.js",
},
},
});
```
Example monorepo config:
```ts
import { defineComputeConfig } from "@prisma/compute-sdk/config";
export default defineComputeConfig({
apps: {
frontend: {
root: "apps/frontend",
framework: "custom",
build: {
command: "npm run build",
outputDirectory: "dist",
entrypoint: "server.js",
},
},
api: {
root: "apps/api",
framework: "hono",
entry: "src/index.ts",
},
},
});
```
```bash
prisma-cli app build frontend
prisma-cli app deploy frontend
```
## Validation
- `pnpm --filter @prisma/cli test`
- `pnpm --recursive exec tsc --noEmit`
- `pnpm lint`
`pnpm lint` exits 0 with existing warnings.
- resolves the optional `[app]` target, app root, framework, and entrypoint from `prisma.compute.ts` exactly like `app deploy`; explicit `--entry` and a non-`auto``--build-type` override the config
891
891
- detects supported project shapes when `--build-type auto` is used and no config framework applies
892
-
- supports Bun, Next.js, Nuxt, Astro, and TanStack Start app builds in the beta package
892
+
- supports Bun, Next.js, Nuxt, Astro, NestJS, TanStack Start, and custom artifact app builds in the beta package
893
893
- fails with `USAGE_ERROR` when framework detection is ambiguous
894
894
895
895
Examples:
@@ -898,9 +898,11 @@ Examples:
898
898
prisma-cli app build --build-type nextjs
899
899
prisma-cli app build --build-type nuxt
900
900
prisma-cli app build --build-type astro
901
+
prisma-cli app build --build-type nestjs
901
902
prisma-cli app build --build-type tanstack-start
902
903
prisma-cli app build --build-type bun --entry server.ts
-`apps` — a multi-app or monorepo repository, keyed by deploy target name
944
946
- each app accepts `name`, `root`, `framework`, `entry`, `httpPort`, `env`, and `build`:
945
947
-`env` is a dotenv file path, or `{ file, vars }` with file path(s) and inline assignments
946
-
-`build` is `{ command, outputDirectory }`; both fields are optional and `command: null` skips the build step
947
-
-`build` applies to frameworks whose preview build consumes committed settings (`nextjs`, `hono`, `tanstack-start`, `bun`); `nuxt` and `astro` builds run their framework CLI automatically, so a `build` block with those frameworks is a validation error (`BUILD_SETTINGS_UNSUPPORTED` when only detected at deploy time)
948
+
-`build` is `{ command, outputDirectory, entrypoint }`; all fields are optional except where a framework requires enough information to stage a runnable artifact, and `command: null` skips the build step
949
+
-`build.entrypoint` is the built artifact entrypoint when `outputDirectory` is set, and is the source entrypoint for Bun/Hono configs that do not set an output directory
950
+
-`framework: "custom"` deploys a prebuilt or custom-built artifact and requires `build.outputDirectory` and `build.entrypoint`
948
951
- when `build` is present, the compute config owns build settings for that app: fields it sets override framework defaults, fields it omits are inferred; without a `build` block, settings are inferred entirely, with their sources shown
949
952
- the compute config does not declare databases in the current beta; database setup stays on the `--db`/`--no-db` flags (a future project-level `database` field is the reserved growth path, since databases are branch resources shared by every app on the branch)
- build commands run with every `node_modules/.bin` between the app and the repository or workspace root on `PATH`, so hoisted workspace binaries resolve
1031
1043
- otherwise `Build Command` falls back to the framework default, such as `next build`
1032
1044
-`Output Directory` is a literal framework output path, such as `.next/standalone`, `.output`, or `.`
1045
+
-`Entrypoint` is shown when the config or framework settings provide a concrete built artifact entrypoint
1033
1046
-`prisma.app.json` is legacy and never read or written; a leftover file that matches the resolved settings produces a deletion warning, an unparsable one is ignored with a warning, and one with custom values fails with `BUILD_SETTINGS_MIGRATION_REQUIRED` including the exact `build` block to move into `prisma.compute.ts`
1034
1047
- after setup, deploy prints `Deploying to <Project> / <Branch> / <App>`; later deploys print a compact target header such as `Deploying ./j1 to j1 / main / j1`
1035
1048
- deploy progress uses short stage copy (`Building locally...`, `Built <size>`, `Uploading...`, `Uploaded`, `Deploying...`, `Deployed`) and never prints `Status: running` or `Deployment is running at ...`
@@ -1052,6 +1065,7 @@ Behavior:
1052
1065
-`--env DATABASE_URL=...`, `--env DIRECT_URL=...`, or the same keys loaded from an env file suppress automatic database prompting; combining those database env vars with `--db` is rejected
1053
1066
- maps user-facing framework names to deploy build strategies
1054
1067
- does not accept `--build-command` or `--output-directory`; custom build settings live in the `build` block of `prisma.compute.ts`
1068
+
- deploys arbitrary framework output with `framework: "custom"` when the config provides a built output directory and entrypoint; `build.command` is optional for prebuilt artifacts
1055
1069
- uses `src/index.ts` as the Hono deploy entrypoint when the app has no `package.json#main` or `package.json#module` and that file exists
1056
1070
- supports vanilla Bun apps with `--framework bun` using `package.json#main` or `package.json#module`, or with `--entry <path>`
1057
1071
- treats `--entry <path>` without `--framework` as a Bun app deploy
Copy file name to clipboardExpand all lines: docs/product/error-conventions.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -239,7 +239,7 @@ Recommended meanings:
239
239
-`COMPUTE_CONFIG_TARGET_REQUIRED`: a multi-app compute config needs an `[app]` target and none was given or inferred
240
240
-`COMPUTE_CONFIG_TARGET_UNKNOWN`: the `[app]` target matches no configured app
241
241
-`BUILD_SETTINGS_MIGRATION_REQUIRED`: a legacy `prisma.app.json` contains custom build settings that must move into the `build` block of `prisma.compute.ts`
242
-
-`BUILD_SETTINGS_UNSUPPORTED`: a compute config `build` block targets a framework whose strategy owns its build (nuxt, astro)
242
+
-`BUILD_SETTINGS_UNSUPPORTED`: a compute config `build` block targets a framework whose SDK strategy does not consume committed build settings
243
243
-`FRAMEWORK_NOT_DETECTED`: app deploy could not detect a supported Beta framework and no explicit framework/build type was provided
244
244
-`DEPLOYMENT_NOT_FOUND`: requested deployment id does not exist
245
245
-`NO_DEPLOYMENTS`: command resolved a branch or app but found no deployments
Copy file name to clipboardExpand all lines: docs/product/resource-model.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,7 +104,7 @@ Rules:
104
104
- the runtime app service is scoped by branch in the platform model
105
105
- the app may be selected or created as part of app deployment workflows
106
106
- app selection is local CLI state when needed for the beta package
107
-
- app build settings live in the `build` block of `prisma.compute.ts` (`command`, `outputDirectory`); `prisma.app.json` is legacy and no longer read
107
+
- app build settings live in the `build` block of `prisma.compute.ts` (`command`, `outputDirectory`, `entrypoint`); `prisma.app.json` is legacy and no longer read
0 commit comments