@@ -25,12 +25,12 @@ EventEmitter.defaultMaxListeners = 100;
2525
2626const verboseOption = new Option (
2727 "--verbose" ,
28- "Print more output during the build"
28+ "Print more output during the build" ,
2929) . default ( process . env . CI === "true" ) ;
3030
3131const sourcePathOption = new Option (
3232 "--source <path>" ,
33- "Specify the source directory containing a CMakeLists.txt file"
33+ "Specify the source directory containing a CMakeLists.txt file" ,
3434) . default ( process . cwd ( ) ) ;
3535
3636// TODO: Add "MinSizeRel" and "RelWithDebInfo"
@@ -48,40 +48,40 @@ const defaultTargets = CMAKE_RN_TARGETS ? CMAKE_RN_TARGETS.split(",") : [];
4848for ( const target of defaultTargets ) {
4949 assert (
5050 ( allTargets as string [ ] ) . includes ( target ) ,
51- `Unexpected target in CMAKE_RN_TARGETS: ${ target } `
51+ `Unexpected target in CMAKE_RN_TARGETS: ${ target } ` ,
5252 ) ;
5353}
5454
5555const targetOption = new Option ( "--target <target...>" , "Targets to build for" )
5656 . choices ( allTargets )
5757 . default (
5858 defaultTargets ,
59- "CMAKE_RN_TARGETS environment variable split by ','"
59+ "CMAKE_RN_TARGETS environment variable split by ','" ,
6060 ) ;
6161
6262const buildPathOption = new Option (
6363 "--build <path>" ,
64- "Specify the build directory to store the configured CMake project"
64+ "Specify the build directory to store the configured CMake project" ,
6565) ;
6666
6767const cleanOption = new Option (
6868 "--clean" ,
69- "Delete the build directory before configuring the project"
69+ "Delete the build directory before configuring the project" ,
7070) ;
7171
7272const outPathOption = new Option (
7373 "--out <path>" ,
74- "Specify the output directory to store the final build artifacts"
74+ "Specify the output directory to store the final build artifacts" ,
7575) . default ( false , "./{build}/{configuration}" ) ;
7676
7777const noAutoLinkOption = new Option (
7878 "--no-auto-link" ,
79- "Don't mark the output as auto-linkable by react-native-node-api"
79+ "Don't mark the output as auto-linkable by react-native-node-api" ,
8080) ;
8181
8282const noWeakNodeApiLinkageOption = new Option (
8383 "--no-weak-node-api-linkage" ,
84- "Don't pass the path of the weak-node-api library from react-native-node-api"
84+ "Don't pass the path of the weak-node-api library from react-native-node-api" ,
8585) ;
8686
8787let program = new Command ( "cmake-rn" )
@@ -99,7 +99,7 @@ let program = new Command("cmake-rn")
9999for ( const platform of platforms ) {
100100 const allOption = new Option (
101101 `--${ platform . id } ` ,
102- `Enable all ${ platform . name } triplets`
102+ `Enable all ${ platform . name } triplets` ,
103103 ) ;
104104 program = program . addOption ( allOption ) ;
105105 program = platform . amendCommand ( program ) ;
@@ -133,13 +133,13 @@ program = program.action(
133133 }
134134 if ( targets . size === 0 ) {
135135 throw new Error (
136- "Found no default targets: Install some platform specific build tools"
136+ "Found no default targets: Install some platform specific build tools" ,
137137 ) ;
138138 } else {
139139 console . error (
140140 chalk . yellowBright ( "ℹ" ) ,
141141 "Using default targets" ,
142- chalk . dim ( "(" + [ ...targets ] . join ( ", " ) + ")" )
142+ chalk . dim ( "(" + [ ...targets ] . join ( ", " ) + ")" ) ,
143143 ) ;
144144 }
145145 }
@@ -162,20 +162,20 @@ program = program.action(
162162
163163 // Configure every triplet project
164164 const targetsSummary = chalk . dim (
165- `(${ getTargetsSummary ( targetContexts ) } )`
165+ `(${ getTargetsSummary ( targetContexts ) } )` ,
166166 ) ;
167167 await oraPromise (
168168 Promise . all (
169169 targetContexts . map ( ( { platform, ...context } ) =>
170- configureProject ( platform , context , baseOptions )
171- )
170+ configureProject ( platform , context , baseOptions ) ,
171+ ) ,
172172 ) ,
173173 {
174174 text : `Configuring projects ${ targetsSummary } ` ,
175175 isSilent : baseOptions . verbose ,
176176 successText : `Configured projects ${ targetsSummary } ` ,
177177 failText : ( { message } ) => `Failed to configure projects: ${ message } ` ,
178- }
178+ } ,
179179 ) ;
180180
181181 // Build every triplet project
@@ -189,20 +189,20 @@ program = program.action(
189189 force : true ,
190190 } ) ;
191191 await buildProject ( platform , context , baseOptions ) ;
192- } )
192+ } ) ,
193193 ) ,
194194 {
195195 text : "Building projects" ,
196196 isSilent : baseOptions . verbose ,
197197 successText : "Built projects" ,
198198 failText : ( { message } ) => `Failed to build projects: ${ message } ` ,
199- }
199+ } ,
200200 ) ;
201201
202202 // Perform post-build steps for each platform in sequence
203203 for ( const platform of platforms ) {
204204 const relevantTargets = targetContexts . filter ( ( { target } ) =>
205- platformHasTarget ( platform , target )
205+ platformHasTarget ( platform , target ) ,
206206 ) ;
207207 if ( relevantTargets . length == 0 ) {
208208 continue ;
@@ -212,7 +212,7 @@ program = program.action(
212212 outputPath : baseOptions . out || baseOptions . source ,
213213 targets : relevantTargets ,
214214 } ,
215- baseOptions
215+ baseOptions ,
216216 ) ;
217217 }
218218 } catch ( error ) {
@@ -221,11 +221,11 @@ program = program.action(
221221 }
222222 throw error ;
223223 }
224- }
224+ } ,
225225) ;
226226
227227function getTargetsSummary (
228- targetContexts : { target : string ; platform : Platform } [ ]
228+ targetContexts : { target : string ; platform : Platform } [ ] ,
229229) {
230230 const targetsPerPlatform : Record < string , string [ ] > = { } ;
231231 for ( const { target, platform } of targetContexts ) {
@@ -257,7 +257,7 @@ function getTargetBuildPath(buildPath: string, target: unknown) {
257257async function configureProject < T extends string > (
258258 platform : Platform < T [ ] , Record < string , unknown > > ,
259259 context : TargetContext < T > ,
260- options : BaseOpts
260+ options : BaseOpts ,
261261) {
262262 const { target, buildPath, outputPath } = context ;
263263 const { verbose, source, weakNodeApiLinkage } = options ;
@@ -286,14 +286,14 @@ async function configureProject<T extends string>(
286286 {
287287 outputMode : verbose ? "inherit" : "buffered" ,
288288 outputPrefix : verbose ? chalk . dim ( `[${ target } ] ` ) : undefined ,
289- }
289+ } ,
290290 ) ;
291291}
292292
293293async function buildProject < T extends string > (
294294 platform : Platform < T [ ] , Record < string , unknown > > ,
295295 context : TargetContext < T > ,
296- options : BaseOpts
296+ options : BaseOpts ,
297297) {
298298 const { target, buildPath } = context ;
299299 const { verbose, configuration } = options ;
@@ -310,7 +310,7 @@ async function buildProject<T extends string>(
310310 {
311311 outputMode : verbose ? "inherit" : "buffered" ,
312312 outputPrefix : verbose ? chalk . dim ( `[${ target } ] ` ) : undefined ,
313- }
313+ } ,
314314 ) ;
315315}
316316
0 commit comments