Commit d88fca9
authored
feat: typed prisma.compute.ts compute config (#84)
## What
Adds **`prisma.compute.ts`** — a typed, committed deploy configuration
for Prisma Compute — and makes the entire `app` command surface
config-aware. One config declares the deployable system (apps, roots,
frameworks, ports, env, build settings); the CLI derives everything
else, with flags as one-shot overrides and detection filling whatever is
omitted.
```ts
import { defineComputeConfig } from "@prisma/compute-sdk/config";
export default defineComputeConfig({
apps: {
api: { root: "apps/api", framework: "hono", entry: "src/index.ts", httpPort: 8080 },
web: { root: "apps/web", framework: "nextjs",
build: { command: "npm run build", outputDirectory: ".next/standalone" } },
},
});
```
```bash
prisma-cli app deploy # deploys api and web, in order
prisma-cli app deploy web # one target
cd apps/api && prisma-cli app deploy # target inferred from cwd
```
## Design rules
- **Discovery is bounded:** nearest config from cwd up to the source
root (`.git`/workspace markers); never escapes the repository;
location-only discovery (no config evaluation) at CLI bootstrap.
- **The config directory is the project directory:**
`.prisma/local.json` pin, the state cache, and the `--db` schema scan
anchor there; config-relative paths resolve from the config file so a
committed config means the same thing from any cwd.
- **One precedence everywhere:** `--app` > `PRISMA_APP_ID` > config
target (positional `[app]` or cwd-inferred, deepest root wins) >
remembered selection > inference. `--env` flags replace config env
entirely.
- **The config never selects Project, Branch, or production** — those
stay explicit per the resource model.
- **Bare `app deploy` against a multi-app config deploys the system**
(declaration order, fail-fast with already-live/not-attempted reporting,
per-app flags rejected, `--create-project` binds once).
- **One framework detection** shared by deploy/build/run, driven by the
capability registry in `@prisma/compute-sdk/config` — adding a framework
is one registry entry plus its strategy. Covers **nextjs, nuxt, astro,
hono, tanstack-start, bun** (matching the git-push path). For nuxt/astro
the strategy owns the build, so a config `build` block is rejected
(`BUILD_SETTINGS_UNSUPPORTED`) instead of silently ignored; with a build
block and no declared framework, `app build` resolves the framework like
deploy does before applying it.
## Also in this PR
- **`prisma.app.json` removed:** never read or written. Leftovers that
match inference warn for deletion; customized ones fail with
`BUILD_SETTINGS_MIGRATION_REQUIRED` showing the exact `build` block —
builds never change silently.
- **Workspace build fixes:** package-manager detection walks up to the
workspace root; ancestor `node_modules/.bin` dirs join the build PATH;
Next.js standalone staging flattens **bun's isolated store** alongside
pnpm's.
- **`--db` is provision-only:** creates the branch database and wires
`DATABASE_URL`/`DIRECT_URL`; never runs `db push`/`migrate
deploy`/`generate`. Suggests the detected schema command plus `database
connection create <id>` (env values are write-only on the platform by
design). 1 parent dc06271 commit d88fca9
42 files changed
Lines changed: 4636 additions & 2426 deletions
File tree
- .github/workflows
- docs/product
- packages/cli
- src
- commands/app
- controllers
- lib
- app
- fs
- git
- project
- presenters
- shell
- types
- tests
- helpers
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
174 | 178 | | |
175 | 179 | | |
176 | 180 | | |
| |||
223 | 227 | | |
224 | 228 | | |
225 | 229 | | |
226 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
227 | 235 | | |
228 | 236 | | |
229 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
| 341 | + | |
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
192 | | - | |
193 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
44 | | - | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
48 | | - | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
0 commit comments