Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/product/command-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Out of scope for the current beta:
non-TTY stderr, and when `NO_UPDATE_NOTIFIER` is set. When shown, update
notifications are stderr-only human output and do not change the original
command result.
- Public Beta does not read or write committed config files such as `prisma.config.ts` or `.prisma/settings.json` for Project -> Branch -> App resolution. `.prisma/local.json` is a gitignored local pin/cache, not a declarative repo config file.
- Public Beta does not read or write committed config files such as `prisma.config.ts` or `.prisma/settings.json` for Project -> Branch -> App resolution. `.prisma/local.json` is a gitignored local pin/cache, not a declarative repo config file. `prisma.app.json` is only for app build settings.
- Remote commands do not silently change local context.

## Authentication
Expand Down Expand Up @@ -645,11 +645,17 @@ Behavior:
- writes `.prisma/local.json` after Project binding succeeds and before build/deploy starts, so retries after a failed deploy do not repeat setup
- before asking `Customize build settings? (y/N)`, previews the detected framework and runtime so the user can see the defaults they are accepting or changing
- asks `Customize build settings? (y/N)` only while binding the directory for the first time, and only asks for Framework and HTTP port when the user opts in
- for Next.js, TanStack Start, and Bun/Hono deploys, reads or creates `prisma.app.json` before build and uses it for app build settings:
- `Build Command` prefers `<package-manager> run build` when `package.json` has `scripts.build`
- otherwise `Build Command` falls back to the framework default, such as `next build`
- `Output Directory` is a literal framework output path, such as `.next/standalone`, `.output`, or `.`
- does not overwrite an existing `prisma.app.json`; edit the file or delete it and rerun deploy to regenerate defaults
- after setup, deploy prints `Deploying to <Project> / <Branch> / <App>`; later deploys print a compact target header such as `Deploying ./j1 to j1 / main / j1`
- deploy progress uses short stage copy (`Building locally...`, `Built <size>`, `Uploading...`, `Uploaded`, `Deploying...`, `Deployed`) and never prints `Status: running` or `Deployment is running at ...`
- success human output prints `Live in <duration>`, the URL on its own line, and `Logs prisma-cli app logs`
- accepts repeated `--env NAME=VALUE` flags
- maps user-facing framework names to deploy build strategies
- does not accept `--build-command` or `--output-directory`; custom build settings are edited in `prisma.app.json`, which is initially generated from `package.json` `scripts.build` and framework defaults for config-backed deploy types
- 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
- supports vanilla Bun apps with `--framework bun` using `package.json#main` or `package.json#module`, or with `--entry <path>`
- treats `--entry <path>` without `--framework` as a Bun app deploy
Expand Down
2 changes: 2 additions & 0 deletions docs/product/error-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ These codes are the minimum stable set for the MVP:
- `APP_AMBIGUOUS`
- `LOCAL_STATE_STALE`
- `BRANCH_NOT_DEPLOYABLE`
- `APP_CONFIG_INVALID`
- `FRAMEWORK_NOT_DETECTED`
- `DEPLOYMENT_NOT_FOUND`
- `NO_DEPLOYMENTS`
Expand Down Expand Up @@ -210,6 +211,7 @@ Recommended meanings:
- `APP_AMBIGUOUS`: multiple apps matched the inferred or explicit app target
- `LOCAL_STATE_STALE`: local Project pin no longer matches platform data and continuing would be ambiguous
- `BRANCH_NOT_DEPLOYABLE`: command tried to deploy to a non-deployable branch context
- `APP_CONFIG_INVALID`: `prisma.app.json` is missing required build settings, has invalid JSON, or points outside the app root
- `FRAMEWORK_NOT_DETECTED`: app deploy could not detect a supported Beta framework and no explicit framework/build type was provided
- `DEPLOYMENT_NOT_FOUND`: requested deployment id does not exist
- `NO_DEPLOYMENTS`: command resolved a branch or app but found no deployments
Expand Down
1 change: 1 addition & 0 deletions docs/product/output-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ Examples:
- `app deploy` should state the resolved target that matters in the current slice
- first local `app deploy` binding should make the Project choice explicit before work begins
- subsequent `app deploy` calls should use a compact target header such as `Deploying ./j1 to j1 / main / j1`
- config-backed `app deploy` builds should show whether they created or used `prisma.app.json` before build starts: `Build Command` with its source when inferred, and `Output Directory` as a literal path such as `.next/standalone` rather than an opaque framework default label
- `app logs` should state the deployment it resolved
- `app list-deploys` should state which app or branch is being listed

Expand Down
2 changes: 2 additions & 0 deletions docs/product/resource-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Rules:
- `project` is not the same thing as `app`
- Public Beta does not read or write committed config files such as `prisma.config.ts` or `.prisma/settings.json` for project resolution
- `.prisma/local.json` is a gitignored local pin/cache for Workspace and Project IDs; it is not a declarative repo config file
- `prisma.app.json` is a committed app build-settings file only; it must not contain Workspace, Project, Branch, App, env, or secret resolution state
- Project setup is explicit: users choose an existing Project or explicitly create a new one before remote work starts
- `app deploy` may orchestrate Project setup, but it must not silently choose or create Project scope
- everything under a project happens in a branch
Expand Down Expand Up @@ -104,6 +105,7 @@ Rules:
- the runtime app service is scoped by branch in the platform model
- the app may be selected or created as part of app deployment workflows
- app selection is local CLI state when needed for the beta package
- app build settings may live in `prisma.app.json` beside `package.json`; v1 fields are `buildCommand` and `outputDirectory`

### Deployment

Expand Down
44 changes: 42 additions & 2 deletions packages/cli/src/controllers/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ import {
executePreviewBuild,
PREVIEW_BUILD_TYPES,
RESOLVED_PREVIEW_BUILD_TYPES,
resolveOrCreatePreviewBuildSettings,
type PreviewBuildSettingsBuildType,
type PreviewBuildSettingsResolution,
type ResolvedPreviewBuildType,
type PreviewBuildType,
} from "../lib/app/preview-build";
Expand Down Expand Up @@ -318,6 +321,12 @@ export async function runAppDeploy(
const buildType = framework.buildType;
assertSupportedEntrypoint(buildType, options?.entrypoint, "deploy");
const entrypoint = await resolveDeployEntrypoint(context.runtime.cwd, framework, options?.entrypoint, context.runtime.signal);
const buildSettingsResolution = await resolveOrCreatePreviewBuildSettings({
appPath: context.runtime.cwd,
buildType,
signal: context.runtime.signal,
});
maybeRenderDeployBuildSettings(context, buildSettingsResolution);
const portMapping = parseDeployPortMapping(String(runtime.port));

const progressState = createPreviewDeployProgressState();
Expand All @@ -331,6 +340,7 @@ export async function runAppDeploy(
region: selectedApp.region,
entrypoint,
buildType,
buildSettings: buildSettingsResolution.settings,
portMapping,
envVars,
interaction: undefined,
Expand Down Expand Up @@ -2261,6 +2271,7 @@ async function resolveProjectContext(
options?: {
branch?: ResolvedDeployBranch;
commandName?: string;
envProjectId?: string;
},
): Promise<ResolvedAppProjectContext> {
const authState = await requireAuthenticatedAuthState(context);
Expand Down Expand Up @@ -2583,7 +2594,7 @@ async function resolveGitHeadPath(gitPath: string, signal: AbortSignal): Promise

interface ResolvedDeployFramework {
key: string;
buildType: ResolvedPreviewBuildType;
buildType: PreviewBuildSettingsBuildType;
displayName: string;
annotation: string;
}
Expand Down Expand Up @@ -2728,7 +2739,6 @@ async function detectNextConfig(cwd: string, signal: AbortSignal): Promise<{ exi
const candidates = [
"next.config.js",
"next.config.mjs",
"next.config.cjs",
"next.config.ts",
"next.config.mts",
];
Expand Down Expand Up @@ -2854,6 +2864,36 @@ async function maybeRenderDeploySetupBlock(
context.output.stderr.write(`${prefix} ${details.projectName} / ${details.branchName} / ${details.appName}\n\n`);
}

function maybeRenderDeployBuildSettings(
context: CommandContext,
resolution: PreviewBuildSettingsResolution,
): void {
if (context.flags.json || context.flags.quiet) {
return;
}

const settings = resolution.settings;
const title = resolution.status === "created"
? `Created ${resolution.relativeConfigPath}`
: `Using ${resolution.relativeConfigPath}`;

context.output.stderr.write(
`${title}\n`
+ `${renderDeployOutputRows(context.ui, [
{
label: "Build Command",
value: settings.buildCommand ?? "none",
origin: settings.buildCommandSource ?? undefined,
},
{
label: "Output Directory",
value: settings.outputDirectory,
origin: settings.outputDirectorySource ?? undefined,
},
]).join("\n")}\n\n`,
);
}

function maybeRenderProjectLinked(
context: CommandContext,
directory: string,
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/lib/app/bun-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import path from "node:path";
export interface BunPackageJsonLike {
main?: unknown;
module?: unknown;
packageManager?: unknown;
scripts?: unknown;
dependencies?: unknown;
devDependencies?: unknown;
Expand Down
Loading
Loading