@prisma/cli 3.0.0-dev.108.1 → 3.0.0-dev.110.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.
|
@@ -66,7 +66,7 @@ function createRunCommand(runtime) {
|
|
|
66
66
|
}
|
|
67
67
|
function createDeployCommand(runtime) {
|
|
68
68
|
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("deploy"), runtime), "app.deploy");
|
|
69
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").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([...FRAMEWORK_KEYS])).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("--region <region>", "Region for a newly created app; existing apps keep their region")).addOption(new Option("--env <name=value|file>", "Environment variable assignment or dotenv file").argParser(collectRepeatableValues)).addOption(new Option("--db", "Create and wire a Prisma Postgres database for this deploy target")).addOption(new Option("--no-db", "Skip database setup")).addOption(new Option("--prod", "Confirm intent to deploy to production"));
|
|
69
|
+
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").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([...FRAMEWORK_KEYS])).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("--region <region>", "Region for a newly created app; existing apps keep their region")).addOption(new Option("--env <name=value|file>", "Environment variable assignment or dotenv file").argParser(collectRepeatableValues)).addOption(new Option("--db", "Create and wire a Prisma Postgres database for this deploy target")).addOption(new Option("--no-db", "Skip database setup")).addOption(new Option("--prod", "Confirm intent to deploy to production")).addOption(new Option("--no-promote", "Build the new deployment without promoting it to live (promote later with app promote <id>)"));
|
|
70
70
|
addGlobalFlags(command);
|
|
71
71
|
command.action(async (configTarget, options) => {
|
|
72
72
|
const appName = options.app;
|
|
@@ -79,6 +79,7 @@ function createDeployCommand(runtime) {
|
|
|
79
79
|
const projectRef = options.project;
|
|
80
80
|
const createProjectName = options.createProject;
|
|
81
81
|
const prod = options.prod;
|
|
82
|
+
const noPromote = options.promote === false;
|
|
82
83
|
const db = options.db;
|
|
83
84
|
const hasDbConflict = hasFlag(runtime.argv, "--db") && hasFlag(runtime.argv, "--no-db");
|
|
84
85
|
await runCommand(runtime, "app.deploy", options, (context) => {
|
|
@@ -93,6 +94,7 @@ function createDeployCommand(runtime) {
|
|
|
93
94
|
region,
|
|
94
95
|
envAssignments,
|
|
95
96
|
prod: prod === true,
|
|
97
|
+
noPromote,
|
|
96
98
|
db,
|
|
97
99
|
configTarget
|
|
98
100
|
});
|
package/dist/controllers/app.js
CHANGED
|
@@ -329,7 +329,8 @@ async function runSingleAppDeploy(context, appName, options, preloadedConfig) {
|
|
|
329
329
|
});
|
|
330
330
|
framework = customized.framework;
|
|
331
331
|
runtime = customized.runtime;
|
|
332
|
-
const
|
|
332
|
+
const noPromote = options?.noPromote === true;
|
|
333
|
+
const productionDeployGate = noPromote ? { firstProductionDeploy: false } : await enforceProductionDeployGate(context, provider, {
|
|
333
334
|
appId: selectedApp.appId,
|
|
334
335
|
appName: selectedApp.displayName,
|
|
335
336
|
branchKind: target.branch.kind,
|
|
@@ -367,6 +368,7 @@ async function runSingleAppDeploy(context, appName, options, preloadedConfig) {
|
|
|
367
368
|
buildSettings: buildSettingsResolution.settings,
|
|
368
369
|
portMapping,
|
|
369
370
|
envVars,
|
|
371
|
+
skipPromote: noPromote,
|
|
370
372
|
interaction: void 0,
|
|
371
373
|
signal: context.runtime.signal,
|
|
372
374
|
progress: createDeployProgress(context.output.stderr, context.ui, !context.flags.json && !context.flags.quiet, progressState)
|
|
@@ -378,7 +380,8 @@ async function runSingleAppDeploy(context, appName, options, preloadedConfig) {
|
|
|
378
380
|
id: deployResult.app.id,
|
|
379
381
|
name: deployResult.app.name
|
|
380
382
|
});
|
|
381
|
-
|
|
383
|
+
const knownLiveDeploymentId = deployResult.promoted ? deployResult.deployment.id : deployResult.app.liveDeploymentId;
|
|
384
|
+
if (knownLiveDeploymentId) await context.stateStore.setKnownLiveDeployment(projectId, deployResult.app.id, knownLiveDeploymentId);
|
|
382
385
|
return {
|
|
383
386
|
command: "app.deploy",
|
|
384
387
|
result: {
|
|
@@ -392,6 +395,7 @@ async function runSingleAppDeploy(context, appName, options, preloadedConfig) {
|
|
|
392
395
|
name: deployResult.app.name
|
|
393
396
|
},
|
|
394
397
|
deployment: deployResult.deployment,
|
|
398
|
+
promoted: deployResult.promoted,
|
|
395
399
|
deploySettings: {
|
|
396
400
|
config: {
|
|
397
401
|
path: buildSettingsResolution.relativeConfigPath,
|
|
@@ -424,7 +428,7 @@ async function runSingleAppDeploy(context, appName, options, preloadedConfig) {
|
|
|
424
428
|
...legacyWarnings,
|
|
425
429
|
...branchDatabaseSetup.warnings
|
|
426
430
|
],
|
|
427
|
-
nextSteps: ["prisma-cli app list-deploys", `prisma-cli app show-deploy ${deployResult.deployment.id}`]
|
|
431
|
+
nextSteps: deployResult.promoted ? ["prisma-cli app list-deploys", `prisma-cli app show-deploy ${deployResult.deployment.id}`] : [`prisma-cli app promote ${deployResult.deployment.id}`, `prisma-cli app show-deploy ${deployResult.deployment.id}`]
|
|
428
432
|
};
|
|
429
433
|
}
|
|
430
434
|
async function resolveDeployBuildSettings(options) {
|
|
@@ -174,6 +174,7 @@ function createAppProvider(client, options) {
|
|
|
174
174
|
region: resolvedApp.region,
|
|
175
175
|
portMapping: options.portMapping,
|
|
176
176
|
envVars: options.envVars,
|
|
177
|
+
skipPromote: options.skipPromote,
|
|
177
178
|
timeoutSeconds: 120,
|
|
178
179
|
pollIntervalMs: 2e3,
|
|
179
180
|
interaction: options.interaction,
|
|
@@ -188,14 +189,16 @@ function createAppProvider(client, options) {
|
|
|
188
189
|
id: deployed.appId,
|
|
189
190
|
name: deployed.appName,
|
|
190
191
|
region: deployed.region ?? null,
|
|
191
|
-
liveDeploymentId: deployed.deploymentId,
|
|
192
|
+
liveDeploymentId: deployed.promoted ? deployed.deploymentId : deployed.previousDeploymentId,
|
|
192
193
|
liveUrl: toAbsoluteUrl(deployed.appEndpointDomain ?? null)
|
|
193
194
|
},
|
|
194
195
|
deployment: {
|
|
195
196
|
id: deployed.deploymentId,
|
|
196
197
|
status: "running",
|
|
197
|
-
url: toAbsoluteUrl(deployed.appEndpointDomain ?? deployed.deploymentEndpointDomain ?? null)
|
|
198
|
-
|
|
198
|
+
url: toAbsoluteUrl(deployed.appEndpointDomain ?? deployed.deploymentEndpointDomain ?? null),
|
|
199
|
+
live: deployed.promoted
|
|
200
|
+
},
|
|
201
|
+
promoted: deployed.promoted
|
|
199
202
|
};
|
|
200
203
|
},
|
|
201
204
|
async updateAppEnv(options) {
|
package/dist/presenters/app.js
CHANGED
|
@@ -31,11 +31,17 @@ function serializeAppBuild(result) {
|
|
|
31
31
|
function renderAppDeploy(context, descriptor, result, options) {
|
|
32
32
|
const logsCommand = options?.logsTarget ? `prisma-cli app logs ${options.logsTarget}` : "prisma-cli app logs";
|
|
33
33
|
return [
|
|
34
|
-
`Live in ${formatDuration(result.durationMs)}`,
|
|
35
|
-
|
|
34
|
+
...result.promoted ? [`Live in ${formatDuration(result.durationMs)}`, ...result.deployment.url ? [context.ui.link(result.deployment.url)] : []] : [
|
|
35
|
+
`Built ${result.deployment.id} in ${formatDuration(result.durationMs)} (not promoted)`,
|
|
36
|
+
...result.deployment.url ? [context.ui.link(result.deployment.url)] : [],
|
|
37
|
+
context.ui.dim("The live deployment is unchanged.")
|
|
38
|
+
],
|
|
36
39
|
...renderBranchDatabaseDeploySummary(context, result),
|
|
37
40
|
"",
|
|
38
|
-
...renderDeployOutputRows(context.ui, [{
|
|
41
|
+
...renderDeployOutputRows(context.ui, [...result.promoted ? [] : [{
|
|
42
|
+
label: "Promote",
|
|
43
|
+
value: `prisma-cli app promote ${result.deployment.id}`
|
|
44
|
+
}], {
|
|
39
45
|
label: "Logs",
|
|
40
46
|
value: logsCommand
|
|
41
47
|
}]),
|