MCPcopy Create free account
hub / github.com/observablehq/framework / createNewDeploy

Method createNewDeploy

src/deploy.ts:407–449  ·  view source on GitHub ↗
(deployTarget: DeployTargetInfo)

Source from the content-addressed store, hash-verified

405
406 // Create the new deploy on the server.
407 private async createNewDeploy(deployTarget: DeployTargetInfo): Promise<string> {
408 if (deployTarget.create) {
409 throw Error("Incorrect deployTarget state");
410 }
411
412 let message = this.deployOptions.message;
413 if (message === undefined) {
414 if (this.effects.isTty) {
415 const input = await this.effects.clack.text({
416 message: "What changed in this deploy?",
417 placeholder: "Enter a deploy message (optional)"
418 });
419 if (this.effects.clack.isCancel(input)) throw new CliError("User canceled deploy", {print: false, exitCode: 0});
420 message = input;
421 } else {
422 message = "";
423 }
424 }
425
426 let deployId;
427 try {
428 deployId = await this.apiClient.postDeploy({projectId: deployTarget.project.id, message});
429 } catch (error) {
430 if (isHttpError(error)) {
431 if (error.statusCode === 404) {
432 throw new CliError(
433 `App ${deployTarget.project.slug} in workspace @${deployTarget.workspace.login} not found.`,
434 {
435 cause: error
436 }
437 );
438 } else if (error.statusCode === 403) {
439 throw new CliError(
440 `You don't have permission to deploy to ${deployTarget.project.slug} in workspace @${deployTarget.workspace.login}.`,
441 {cause: error}
442 );
443 }
444 }
445 throw error;
446 }
447
448 return deployId;
449 }
450
451 // Get the list of build files, doing a build if necessary.
452 private async getBuildFilePaths(): Promise<string[]> {

Callers 1

startNewDeployMethod · 0.95

Calls 4

isHttpErrorFunction · 0.85
isCancelMethod · 0.80
postDeployMethod · 0.80
textMethod · 0.45

Tested by

no test coverage detected