@@ -23,12 +23,7 @@ const NODE_MEMORY_FLAGS = ['--max-old-space-size=8192']
2323// Simple CLI helpers without registry dependencies.
2424const isQuiet = ( ) => process . argv . includes ( '--quiet' )
2525const isVerbose = ( ) => process . argv . includes ( '--verbose' )
26- const log = {
27- info : msg => logger . info ( msg ) ,
28- step : msg => logger . step ( msg ) ,
29- success : msg => logger . success ( msg ) ,
30- error : msg => logger . error ( msg ) ,
31- }
26+
3227const printHeader = title => {
3328 logger . log ( '' )
3429 logger . log ( title )
@@ -83,7 +78,7 @@ async function fixNodeGypStrings(dir, options = {}) {
8378 await fs . writeFile ( filePath , fixed , 'utf8' )
8479
8580 if ( ! quiet && verbose ) {
86- log . info (
81+ logger . info (
8782 `Fixed node-gyp string in ${ path . relative ( packageRoot , filePath ) } ` ,
8883 )
8984 }
@@ -106,7 +101,7 @@ async function main() {
106101 // Delegate to watch mode.
107102 if ( watch ) {
108103 if ( ! quiet ) {
109- log . info ( 'Starting watch mode...' )
104+ logger . info ( 'Starting watch mode...' )
110105 }
111106
112107 // First download yoga WASM (only needed asset for CLI bundle).
@@ -164,28 +159,28 @@ async function main() {
164159 // Phase 1: Clean (if needed).
165160 if ( shouldClean ) {
166161 if ( ! quiet ) {
167- log . step ( 'Phase 1: Cleaning...' )
162+ logger . step ( 'Phase 1: Cleaning...' )
168163 }
169164 const result = await spawn ( 'pnpm' , [ 'run' , 'clean:dist' ] , {
170165 shell : WIN32 ,
171166 stdio : 'inherit' ,
172167 } )
173168 if ( result . code !== 0 ) {
174169 if ( ! quiet ) {
175- log . error ( `Clean failed (exit code: ${ result . code } )` )
170+ logger . error ( `Clean failed (exit code: ${ result . code } )` )
176171 printError ( 'Build failed' )
177172 }
178173 process . exitCode = 1
179174 return
180175 }
181176 if ( ! quiet && verbose ) {
182- log . success ( 'Clean completed' )
177+ logger . success ( 'Clean completed' )
183178 }
184179 }
185180
186181 // Phase 2: Generate packages and download assets in parallel.
187182 if ( ! quiet ) {
188- log . step ( 'Phase 2: Preparing build (parallel)...' )
183+ logger . step ( 'Phase 2: Preparing build (parallel)...' )
189184 }
190185
191186 const parallelPrep = await Promise . all ( [
@@ -205,7 +200,7 @@ async function main() {
205200 // Check for null spawn result.
206201 if ( ! result ) {
207202 if ( ! quiet ) {
208- log . error ( `${ stepName } failed to start` )
203+ logger . error ( `${ stepName } failed to start` )
209204 printError ( 'Build failed' )
210205 }
211206 process . exitCode = 1
@@ -214,21 +209,21 @@ async function main() {
214209
215210 if ( result . code !== 0 ) {
216211 if ( ! quiet ) {
217- log . error ( `${ stepName } failed (exit code: ${ result . code } )` )
212+ logger . error ( `${ stepName } failed (exit code: ${ result . code } )` )
218213 printError ( 'Build failed' )
219214 }
220215 process . exitCode = result . code ?? 1
221216 return
222217 }
223218
224219 if ( ! quiet && verbose ) {
225- log . success ( `${ stepName } completed` )
220+ logger . success ( `${ stepName } completed` )
226221 }
227222 }
228223
229224 // Phase 3: Build all variants.
230225 if ( ! quiet ) {
231- log . step ( 'Phase 3: Building variants...' )
226+ logger . step ( 'Phase 3: Building variants...' )
232227 }
233228
234229 // Ensure dist directory exists before building variants.
@@ -245,28 +240,28 @@ async function main() {
245240
246241 if ( buildResult . code !== 0 ) {
247242 if ( ! quiet ) {
248- log . error ( `Build failed (exit code: ${ buildResult . code } )` )
243+ logger . error ( `Build failed (exit code: ${ buildResult . code } )` )
249244 printError ( 'Build failed' )
250245 }
251246 process . exitCode = 1
252247 return
253248 }
254249
255250 if ( ! quiet && verbose ) {
256- log . success ( 'Build completed' )
251+ logger . success ( 'Build completed' )
257252 }
258253
259254 // Phase 4: Post-processing (parallel).
260255 if ( ! quiet ) {
261- log . step ( 'Phase 4: Post-processing (parallel)...' )
256+ logger . step ( 'Phase 4: Post-processing (parallel)...' )
262257 }
263258
264259 await Promise . all ( [
265260 // Copy CLI bundle to dist (required for dist/index.js to work).
266261 ( async ( ) => {
267262 copyFileSync ( 'build/cli.js' , 'dist/cli.js' )
268263 if ( ! quiet && verbose ) {
269- log . success ( 'CLI bundle copied' )
264+ logger . success ( 'CLI bundle copied' )
270265 }
271266 } ) ( ) ,
272267
@@ -277,25 +272,18 @@ async function main() {
277272 verbose,
278273 } )
279274 if ( ! quiet && verbose ) {
280- log . success ( 'Build output post-processed' )
275+ logger . success ( 'Build output post-processed' )
281276 }
282277 } ) ( ) ,
283278
284- // Copy files from repo root.
279+ // Copy CHANGELOG.md from repo root (LICENSE and logos are already in cli package) .
285280 ( async ( ) => {
286- const filesToCopy = [
287- 'CHANGELOG.md' ,
288- 'LICENSE' ,
289- 'logo-dark.png' ,
290- 'logo-light.png' ,
291- ]
292- await Promise . all (
293- filesToCopy . map ( file =>
294- fs . cp ( path . join ( repoRoot , file ) , path . join ( packageRoot , file ) ) ,
295- ) ,
281+ await fs . cp (
282+ path . join ( repoRoot , 'CHANGELOG.md' ) ,
283+ path . join ( packageRoot , 'CHANGELOG.md' ) ,
296284 )
297285 if ( ! quiet && verbose ) {
298- log . success ( 'Files copied from repo root' )
286+ logger . success ( 'CHANGELOG.md copied from repo root' )
299287 }
300288 } ) ( ) ,
301289 ] )
0 commit comments