@@ -7,6 +7,63 @@ import { supportedPlatforms } from '../../utils/supportedPlatforms.js';
77import type { BuildFlags } from './buildOptions.js' ;
88import { simulatorDestinationMap } from './simulatorDestinationMap.js' ;
99
10+ let lastProgress = 0 ;
11+ /**
12+ * Creates an ASCII progress bar
13+ * @param percent - Percentage of completion (0-100)
14+ * @param length - Length of the progress bar in characters
15+ * @returns ASCII progress bar string
16+ */
17+ function createProgressBar ( percent : number , length = 20 ) : string {
18+ const latestPercent = percent > lastProgress ? percent : lastProgress ;
19+ lastProgress = latestPercent ;
20+ const filledLength = Math . round ( length * ( latestPercent / 100 ) ) ;
21+ const emptyLength = length - filledLength ;
22+
23+ const filled = '█' . repeat ( filledLength ) ;
24+ const empty = '░' . repeat ( emptyLength ) ;
25+
26+ return `[${ filled } ${ empty } ]` ;
27+ }
28+
29+ function reportProgress (
30+ chunk : string ,
31+ loader : ReturnType < typeof spinner > ,
32+ message : string
33+ ) {
34+ if ( chunk . includes ( 'PhaseScriptExecution' ) ) {
35+ if ( chunk . includes ( '[CP-User]\\ [Hermes]\\ Replace\\ Hermes\\' ) ) {
36+ const progressBar = createProgressBar ( 10 ) ;
37+ loader . message ( `${ message } ${ progressBar } ` ) ;
38+ }
39+ if (
40+ chunk . includes ( '[CP-User]\\ [RN]Check\\ rncore' ) &&
41+ chunk . includes ( 'React-Fabric' )
42+ ) {
43+ const progressBar = createProgressBar ( 35 ) ;
44+ loader . message ( `${ message } ${ progressBar } ` ) ;
45+ }
46+ if ( chunk . includes ( '[CP-User]\\ [RN]Check\\ FBReactNativeSpec' ) ) {
47+ const progressBar = createProgressBar ( 53 ) ;
48+ loader . message ( `${ message } ${ progressBar } ` ) ;
49+ }
50+ if (
51+ chunk . includes ( '[CP-User]\\ [RN]Check\\ rncore' ) &&
52+ chunk . includes ( 'React-FabricComponents' )
53+ ) {
54+ const progressBar = createProgressBar ( 66 ) ;
55+ loader . message ( `${ message } ${ progressBar } ` ) ;
56+ }
57+ if ( chunk . includes ( '[CP]\\ Check\\ Pods\\ Manifest.lock' ) ) {
58+ const progressBar = createProgressBar ( 90 ) ;
59+ loader . message ( `${ message } ${ progressBar } ` ) ;
60+ }
61+ } else if ( chunk . includes ( 'BUILD SUCCEEDED' ) ) {
62+ const progressBar = createProgressBar ( 100 ) ;
63+ loader . message ( `${ message } ${ progressBar } ` ) ;
64+ }
65+ }
66+
1067export const buildProject = async (
1168 xcodeProject : XcodeProjectInfo ,
1269 sourceDir : string ,
@@ -103,10 +160,17 @@ export const buildProject = async (
103160
104161 loader . start ( message ) ;
105162 try {
106- const { output } = await spawn ( 'xcodebuild' , xcodebuildArgs , {
163+ const process = spawn ( 'xcodebuild' , xcodebuildArgs , {
107164 cwd : sourceDir ,
108165 stdio : logger . isVerbose ( ) ? 'inherit' : [ 'ignore' , 'pipe' , 'pipe' ] ,
109166 } ) ;
167+
168+ // Process the output from the AsyncIterable
169+ for await ( const chunk of process ) {
170+ reportProgress ( chunk , loader , message ) ;
171+ }
172+
173+ const { output } = await process ;
110174 loader . stop (
111175 `${
112176 args . archive ? 'Archived' : 'Built'
0 commit comments