@@ -4,13 +4,19 @@ import { walk, type WalkEntry } from "@std/fs";
44import { ProgressBar } from "@std/cli/unstable-progress-bar" ;
55import { Spinner } from "@std/cli/unstable-spinner" ;
66import { join , relative , resolve , SEPARATOR } from "@std/path" ;
7- import { green , yellow } from "@std/fmt/colors" ;
7+ import { green , red , yellow } from "@std/fmt/colors" ;
88import { type Config , writeConfig } from "./config.ts" ;
99import { authedFetch , createTrpcClient } from "./auth.ts" ;
1010import { error } from "./util.ts" ;
1111
1212const SEPARATOR_PATTERN = Deno . build . os === "windows" ? "\\\\" : "/" ;
1313
14+ interface Revision {
15+ labels : Record < string , string > ;
16+ steps : { step : string } [ ] ;
17+ status : "cancelled" ;
18+ }
19+
1420type Chunk =
1521 & { chunk : WalkEntry ; relativePath : string }
1622 & ( { hash ?: undefined ; data ?: undefined } | {
@@ -156,13 +162,15 @@ export async function publish(
156162 } ) ;
157163 existingFilesSpinner . start ( ) ;
158164
165+ let revision : Revision | undefined = undefined ;
159166 // deno-lint-ignore no-explicit-any
160167 const sub = await ( trpcClient . revisions as any ) . watchUntilReady . subscribe ( {
161168 org,
162169 app,
163170 revision : revisionId ,
164171 } , {
165- onData : ( data : { labels : Record < string , string > } ) => {
172+ onData : ( data : Revision ) => {
173+ revision = data ;
166174 if ( "deno.diffsync.missing_hashes" in data . labels ) {
167175 missingHashesPromise . resolve (
168176 JSON . parse ( data . labels [ "deno.diffsync.missing_hashes" ] ) ,
@@ -317,7 +325,8 @@ export async function publish(
317325 app,
318326 revision : revisionId ,
319327 } , {
320- onData : ( newRevision : { steps : { step : string } [ ] } ) => {
328+ onData : ( newRevision : Revision ) => {
329+ revision = newRevision ;
321330 const lastStep = newRevision . steps . at ( - 1 ) ;
322331
323332 if ( lastStep ) {
@@ -340,6 +349,15 @@ export async function publish(
340349 await completionPromise . promise ;
341350
342351 completionSpinner . stop ( ) ;
352+ if ( revision ! . status === "cancelled" ) {
353+ console . log (
354+ `\n${
355+ red ( "✗" )
356+ } The revision was cancelled.\nPlease view the revision in the dashboard for more information.`,
357+ ) ;
358+ Deno . exit ( 1 ) ;
359+ }
360+
343361 console . log ( `\n${ green ( "✔" ) } Successfully deployed your application!` ) ;
344362
345363 const timelines : Array < { partition_config_name : string ; domains : string [ ] } > =
0 commit comments