@@ -80,6 +80,7 @@ const DeployCommandOptions = CommonCommandOptions.extend({
8080 builder : z . string ( ) . default ( "trigger" ) ,
8181 nativeBuildServer : z . boolean ( ) . default ( false ) ,
8282 detach : z . boolean ( ) . default ( false ) ,
83+ plain : z . boolean ( ) . default ( false ) ,
8384} ) ;
8485
8586type DeployCommandOptions = z . infer < typeof DeployCommandOptions > ;
@@ -184,6 +185,7 @@ export function configureDeployCommand(program: Command) {
184185 "Return immediately after the deployment is queued, do not wait for the build to complete. Implies using the native build server."
185186 ) . implies ( { nativeBuildServer : true } )
186187 )
188+ . addOption ( new CommandOption ( "--plain" , "Plain output" ) . hideHelp ( ) )
187189 . action ( async ( path , options ) => {
188190 await handleTelemetry ( async ( ) => {
189191 await printStandloneInitialBanner ( true ) ;
@@ -200,7 +202,9 @@ export async function deployCommand(dir: string, options: unknown) {
200202}
201203
202204async function _deployCommand ( dir : string , options : DeployCommandOptions ) {
203- intro ( `Deploying project${ options . skipPromotion ? " (without promotion)" : "" } ` ) ;
205+ if ( ! options . plain ) {
206+ intro ( `Deploying project${ options . skipPromotion ? " (without promotion)" : "" } ` ) ;
207+ }
204208
205209 if ( ! options . skipUpdateCheck ) {
206210 await updateTriggerPackages ( dir , { ...options } , true , true ) ;
@@ -215,6 +219,7 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
215219 embedded : true ,
216220 defaultApiUrl : options . apiUrl ,
217221 profile : options . profile ,
222+ silent : options . plain ,
218223 } ) ;
219224
220225 if ( ! authorization . ok ) {
@@ -321,7 +326,7 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
321326
322327 const destination = getTmpDir ( resolvedConfig . workingDir , "build" , options . dryRun ) ;
323328
324- const $buildSpinner = spinner ( ) ;
329+ const $buildSpinner = spinner ( { plain : options . plain } ) ;
325330
326331 const forcedExternals = await resolveAlwaysExternal ( projectClient . client ) ;
327332
@@ -337,13 +342,13 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
337342 rewritePaths : true ,
338343 envVars : serverEnvVars . success ? serverEnvVars . data . variables : { } ,
339344 forcedExternals,
345+ plain : options . plain ,
340346 listener : {
341347 onBundleStart ( ) {
342348 $buildSpinner . start ( "Building trigger code" ) ;
343349 } ,
344350 onBundleComplete ( result ) {
345351 $buildSpinner . stop ( "Successfully built code" ) ;
346-
347352 logger . debug ( "Bundle result" , result ) ;
348353 } ,
349354 } ,
@@ -403,7 +408,7 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
403408 const vars = numberOfEnvVars === 1 ? "var" : "vars" ;
404409
405410 if ( ! options . skipSyncEnvVars ) {
406- const $spinner = spinner ( ) ;
411+ const $spinner = spinner ( { plain : options . plain } ) ;
407412 $spinner . start ( `Syncing ${ numberOfEnvVars } env ${ vars } with the server` ) ;
408413
409414 const uploadResult = await syncEnvVarsWithServer (
@@ -445,14 +450,16 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
445450 const deploymentLink = cliLink ( "View deployment" , rawDeploymentLink ) ;
446451 const testLink = cliLink ( "Test tasks" , rawTestLink ) ;
447452
448- const $spinner = spinner ( ) ;
453+ const $spinner = spinner ( { plain : options . plain } ) ;
449454
450455 const buildSuffix =
451456 isLocalBuild && ! process . env . TRIGGER_LOCAL_BUILD_LABEL_DISABLED ? " (local)" : "" ;
452457 const deploySuffix =
453458 isLocalBuild && ! process . env . TRIGGER_LOCAL_BUILD_LABEL_DISABLED ? " (local build)" : "" ;
454459
455- if ( isCI ) {
460+ if ( options . plain ) {
461+ $spinner . start ( `Building version ${ version } ${ buildSuffix } ` ) ;
462+ } else if ( isCI ) {
456463 log . step ( `Building version ${ version } \n` ) ;
457464 } else {
458465 if ( isLinksSupported ) {
@@ -485,7 +492,7 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
485492 compilationPath : destination . path ,
486493 buildEnvVars : buildManifest . build . env ,
487494 onLog : ( logMessage ) => {
488- if ( isCI ) {
495+ if ( options . plain || isCI ) {
489496 console . log ( logMessage ) ;
490497 return ;
491498 }
@@ -582,7 +589,9 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
582589 throw new SkipLoggingError ( errorData ?. message ?? "Failed to get deployment with worker" ) ;
583590 }
584591
585- if ( isCI ) {
592+ if ( options . plain ) {
593+ $spinner . message ( `Deploying version ${ version } ${ deploySuffix } ` ) ;
594+ } else if ( isCI ) {
586595 log . step ( `Deploying version ${ version } ${ deploySuffix } \n` ) ;
587596 } else {
588597 if ( isLinksSupported ) {
@@ -600,7 +609,7 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
600609 skipPushToRegistry : remoteBuildExplicitlySkipped ,
601610 } ,
602611 ( logMessage ) => {
603- if ( isCI ) {
612+ if ( options . plain || isCI ) {
604613 console . log ( logMessage ) ;
605614 return ;
606615 }
@@ -627,26 +636,39 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
627636 throw new SkipLoggingError ( "Failed to finalize deployment" ) ;
628637 }
629638
630- if ( isCI ) {
639+ if ( options . plain ) {
640+ console . log ( `Successfully deployed version ${ version } ${ deploySuffix } ` ) ;
641+ } else if ( isCI ) {
631642 log . step ( `Successfully deployed version ${ version } ${ deploySuffix } ` ) ;
632643 } else {
633644 $spinner . stop ( `Successfully deployed version ${ version } ${ deploySuffix } ` ) ;
634645 }
635646
636647 const taskCount = deploymentWithWorker . worker ?. tasks . length ?? 0 ;
637648
638- outro (
639- `Version ${ version } deployed with ${ taskCount } detected task${ taskCount === 1 ? "" : "s" } ${
640- isLinksSupported ? `| ${ deploymentLink } | ${ testLink } ` : ""
641- } `
642- ) ;
649+ if ( options . plain ) {
650+ console . log (
651+ `Version ${ version } deployed with ${ taskCount } detected task${ taskCount === 1 ? "" : "s" } `
652+ ) ;
653+
654+ if ( ! process . env . TRIGGER_DEPLOYMENT_LINK_OUTPUT_DISABLED ) {
655+ console . log ( `Deployment: ${ rawDeploymentLink } ` ) ;
656+ console . log ( `Test: ${ rawTestLink } ` ) ;
657+ }
658+ } else {
659+ outro (
660+ `Version ${ version } deployed with ${ taskCount } detected task${ taskCount === 1 ? "" : "s" } ${
661+ isLinksSupported ? `| ${ deploymentLink } | ${ testLink } ` : ""
662+ } `
663+ ) ;
643664
644- if ( ! isLinksSupported ) {
645- console . log ( "View deployment" ) ;
646- console . log ( rawDeploymentLink ) ;
647- console . log ( ) ; // new line
648- console . log ( "Test tasks" ) ;
649- console . log ( rawTestLink ) ;
665+ if ( ! isLinksSupported ) {
666+ console . log ( "View deployment" ) ;
667+ console . log ( rawDeploymentLink ) ;
668+ console . log ( ) ; // new line
669+ console . log ( "Test tasks" ) ;
670+ console . log ( rawTestLink ) ;
671+ }
650672 }
651673
652674 if ( options . saveLogs ) {
0 commit comments