@@ -579,54 +579,72 @@ const getOutputTerminalCapabilities = () =>
579579const runUiCheckAction = async (
580580 {
581581 browserExecutable,
582+ interactive,
582583 outputFormat,
583584 routes,
584585 target,
585586 } : {
586587 browserExecutable ?: string ;
588+ interactive : boolean ;
587589 outputFormat : OutputFormat ;
588590 routes ?: string [ ] ;
589591 target : string ;
590592 } ,
591593 runtime : UiCheckRuntime = { }
592594) : Promise < void > => {
593- const resolvedTarget = resolveOverflowCheckTarget ( { routes, target } ) ;
594- let runBrowserCheck = runtime . runBrowserCheck ;
595-
596- if ( ! runBrowserCheck ) {
597- ( { runOverflowBrowserCheck : runBrowserCheck } = await import (
598- "./overflow-check/browser"
599- ) ) ;
600- }
595+ const progress = createCliScanProgress (
596+ outputFormat === "human" && interactive
597+ ) ;
598+ const resolvedTarget = await progress . run ( "Resolving UI target" , ( ) =>
599+ resolveOverflowCheckTarget ( { routes, target } )
600+ ) ;
601601
602602 const abortController = new AbortController ( ) ;
603603 const abortCheck = ( ) : void => abortController . abort ( ) ;
604604 process . once ( "SIGINT" , abortCheck ) ;
605605 process . once ( "SIGTERM" , abortCheck ) ;
606606
607607 try {
608- const browserResult = await runBrowserCheck ( {
609- browserExecutable,
610- origin : resolvedTarget . origin ,
611- pages : resolvedTarget . pages ,
612- signal : abortController . signal ,
613- } ) ;
614- const report = evaluateOverflowCheck ( {
615- durationMs : browserResult . durationMs ,
616- measurements : browserResult . measurements ,
617- target : {
618- origin : browserResult . origin ,
619- pages : resolvedTarget . pages . map ( ( page ) => page . displayPath ) ,
620- } ,
608+ const browserResult = await progress . run (
609+ "Checking mobile and desktop layouts" ,
610+ async ( ) => {
611+ let runBrowserCheck = runtime . runBrowserCheck ;
612+
613+ if ( ! runBrowserCheck ) {
614+ ( { runOverflowBrowserCheck : runBrowserCheck } = await import (
615+ "./overflow-check/browser"
616+ ) ) ;
617+ }
618+
619+ return await runBrowserCheck ( {
620+ browserExecutable,
621+ origin : resolvedTarget . origin ,
622+ pages : resolvedTarget . pages ,
623+ signal : abortController . signal ,
624+ } ) ;
625+ }
626+ ) ;
627+ const { output, report } = await progress . run ( "Preparing UI report" , ( ) => {
628+ const preparedReport = evaluateOverflowCheck ( {
629+ durationMs : browserResult . durationMs ,
630+ measurements : browserResult . measurements ,
631+ target : {
632+ origin : browserResult . origin ,
633+ pages : resolvedTarget . pages . map ( ( page ) => page . displayPath ) ,
634+ } ,
635+ } ) ;
636+ const preparedOutput =
637+ outputFormat === "json"
638+ ? `${ JSON . stringify ( preparedReport , null , 2 ) } \n`
639+ : renderOverflowCheckReport ( preparedReport , {
640+ requestedOrigin : resolvedTarget . origin ,
641+ terminal : getOutputTerminalCapabilities ( ) ,
642+ } ) ;
643+
644+ return { output : preparedOutput , report : preparedReport } ;
621645 } ) ;
622- const output =
623- outputFormat === "json"
624- ? `${ JSON . stringify ( report , null , 2 ) } \n`
625- : renderOverflowCheckReport ( report , {
626- requestedOrigin : resolvedTarget . origin ,
627- terminal : getOutputTerminalCapabilities ( ) ,
628- } ) ;
629646
647+ progress . finish ( ) ;
630648 process . stdout . write ( output ) ;
631649 if ( report . status === "fail" ) {
632650 process . exitCode = 1 ;
@@ -758,6 +776,7 @@ const runScanAction = async (
758776 await runUiCheckAction (
759777 {
760778 browserExecutable : options . browserExecutable ,
779+ interactive : options . interactive ,
761780 outputFormat,
762781 routes : options . route ,
763782 target : uiCheckTarget ,
@@ -988,7 +1007,10 @@ const createProgram = (runtime: UiCheckRuntime = {}): Command => {
9881007 )
9891008 . option ( "--no-roast" , "Use neutral human output." )
9901009 . option ( "--roast" , "Force roast copy in CI and JSON output." )
991- . option ( "--no-interactive" , "Disable Shadscan follow-up prompts." )
1010+ . option (
1011+ "--no-interactive" ,
1012+ "Disable terminal progress and follow-up prompts."
1013+ )
9921014 . option (
9931015 "--list-projects" ,
9941016 "List the workspace packages shadscan found, without scanning."
0 commit comments