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
Copy file name to clipboardExpand all lines: src/cli/deploy.ts
+94-5Lines changed: 94 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,9 @@ import {
17
17
CONVEX_SELF_HOSTED_URL_VAR_NAME,
18
18
CONVEX_DEPLOYMENT_ENV_VAR_NAME,
19
19
bigBrainAPI,
20
+
bigBrainAPIMaybeThrows,
21
+
logAndHandleFetchError,
22
+
ThrowingFetchError,
20
23
}from"./lib/utils/utils.js";
21
24
import{runFunctionAndLog}from"./lib/run.js";
22
25
import{usageStateWarning}from"./lib/usage.js";
@@ -45,7 +48,13 @@ export const deploy = new Command("deploy")
45
48
newOption(
46
49
"--preview-create <name>",
47
50
"The name to associate with this deployment if deploying to a newly created preview deployment. Defaults to the current Git branch name in Vercel, Netlify and GitHub CI. This is ignored if deploying to a production deployment.",
"Updates existing preview deployment if it exists, otherwise creates a new preview deployment. The name to associate with this deployment if deploying to a newly created preview deployment. Defaults to the current Git branch name in Vercel, Netlify and GitHub CI. This is ignored if deploying to a production deployment.",
57
+
).conflicts(["preview-name","preview-create"]),
49
58
)
50
59
.addOption(
51
60
newOption(
@@ -126,7 +135,8 @@ Same format as .env.local or .env files, and overrides them.`,
"`npx convex deploy` to a preview deployment could not whether you wanted to create a preview deployment or update a previous preview deployment. Use either `--preview-create or --preview-deploy-or-create`",
220
+
});
221
+
}
222
+
if(!previewName){
223
+
returnawaitctx.crash({
176
224
exitCode: 1,
177
225
errorType: "fatal",
178
226
printedMessage:
179
227
"`npx convex deploy` to a preview deployment could not determine the preview name. Provide one using `--preview-create`",
180
228
});
181
229
}
182
230
231
+
// Dry run
183
232
if(options.dryRun){
184
233
logFinishedStep(
185
234
`Would have claimed preview deployment for "${previewName}"`,
@@ -199,6 +248,46 @@ async function deployToNewPreviewDeployment(
199
248
}
200
249
return;
201
250
}
251
+
252
+
// Try deploying to existing preview - if does not exist will fall through to preview create deployment
0 commit comments