11import fs from 'node:fs' ;
22import path from 'node:path' ;
33
4- import { logger } from '@rock-js/tools' ;
4+ import { intro , logger , outro } from '@rock-js/tools' ;
55import {
66 DEFAULT_ANDROID_JAVA_PACKAGE ,
77 getNavigationPackagePath ,
@@ -53,7 +53,11 @@ function getOutputPaths(
5353 const androidPackagePathSegments = androidJavaPackageName . split ( '.' ) ;
5454
5555 return {
56- turboModuleSpec : path . join ( packageRoot , 'src' , 'NativeBrownfieldNavigation.ts' ) ,
56+ turboModuleSpec : path . join (
57+ packageRoot ,
58+ 'src' ,
59+ 'NativeBrownfieldNavigation.ts'
60+ ) ,
5761 navigationTs : path . join ( packageRoot , 'src' , 'index.ts' ) ,
5862 commonjsIndexJs : path . join ( packageRoot , 'lib' , 'commonjs' , 'index.js' ) ,
5963 moduleIndexJs : path . join ( packageRoot , 'lib' , 'module' , 'index.js' ) ,
@@ -78,7 +82,11 @@ function getOutputPaths(
7882 'ios' ,
7983 'BrownfieldNavigationDelegate.swift'
8084 ) ,
81- swiftModels : path . join ( packageRoot , 'ios' , 'BrownfieldNavigationModels.swift' ) ,
85+ swiftModels : path . join (
86+ packageRoot ,
87+ 'ios' ,
88+ 'BrownfieldNavigationModels.swift'
89+ ) ,
8290 objcImplementation : path . join (
8391 packageRoot ,
8492 'ios' ,
@@ -207,14 +215,16 @@ export async function runNavigationCodegen({
207215 throw new Error ( `Spec file not found: ${ resolvedSpecPath } ` ) ;
208216 }
209217
218+ intro ( `Running Brownfield Navigation codegen` ) ;
219+
210220 logger . info ( `Parsing spec file: ${ resolvedSpecPath } ` ) ;
211221 const methods = parseNavigationSpec ( resolvedSpecPath ) ;
212222 if ( methods . length === 0 ) {
213223 throw new Error ( 'No methods found in spec file' ) ;
214224 }
215225
216226 logger . info (
217- `Found ${ methods . length } method(s) : ${ methods . map ( ( method ) => method . name ) . join ( ', ' ) } `
227+ `Found ${ methods . length } method${ methods . length === 1 ? '' : 's' } : ${ methods . map ( ( method ) => method . name ) . join ( ', ' ) } `
218228 ) ;
219229
220230 const packageRoot = getNavigationPackagePath ( projectRoot ) ;
@@ -244,13 +254,21 @@ export async function runNavigationCodegen({
244254 artifacts . swiftModels = models . swiftModels ;
245255 artifacts . kotlinModels = models . kotlinModels ;
246256 } else {
247- logger . info ( 'No complex model types found; skipping quicktype model generation' ) ;
257+ logger . info (
258+ 'No complex model types found; skipping quicktype model generation'
259+ ) ;
248260 }
249261
250262 if ( dryRun ) {
251263 printDryRun ( androidJavaPackageName , artifacts ) ;
264+ outro ( 'Brownfield Navigation codegen done' ) ;
252265 return ;
253266 }
254267
255- writeArtifacts ( getOutputPaths ( packageRoot , androidJavaPackageName ) , artifacts ) ;
268+ writeArtifacts (
269+ getOutputPaths ( packageRoot , androidJavaPackageName ) ,
270+ artifacts
271+ ) ;
272+
273+ outro ( 'Brownfield Navigation codegen done' ) ;
256274}
0 commit comments