@@ -18,7 +18,7 @@ import {
1818 prettyPath ,
1919} from "react-native-node-api" ;
2020
21- import { UsageError } from "./errors.js" ;
21+ import { UsageError , assertFixable } from "./errors.js" ;
2222import { ensureCargo , build } from "./cargo.js" ;
2323import {
2424 ALL_TARGETS ,
@@ -62,9 +62,26 @@ const ANDROID_TRIPLET_PER_TARGET: Record<AndroidTargetName, AndroidTriplet> = {
6262const DEFAULT_NDK_VERSION = "27.1.12297006" ;
6363const ANDROID_API_LEVEL = 24 ;
6464
65+ const { FERRIC_TARGETS } = process . env ;
66+
67+ function getDefaultTargets ( ) {
68+ const result = FERRIC_TARGETS ? FERRIC_TARGETS . split ( "," ) : [ ] ;
69+ for ( const target of result ) {
70+ assertFixable (
71+ ( ALL_TARGETS as readonly string [ ] ) . includes ( target ) ,
72+ `Unexpected target in FERRIC_TARGETS: ${ target } ` ,
73+ {
74+ instructions :
75+ "Pass only valid targets via FERRIC_TARGETS (or remove them)" ,
76+ }
77+ ) ;
78+ }
79+ return result as ( typeof ALL_TARGETS ) [ number ] [ ] ;
80+ }
81+
6582const targetOption = new Option ( "--target <target...>" , "Target triple" )
6683 . choices ( ALL_TARGETS )
67- . default ( [ ] ) ;
84+ . default ( getDefaultTargets ( ) ) ;
6885const appleTarget = new Option ( "--apple" , "Use all Apple targets" ) ;
6986const androidTarget = new Option ( "--android" , "Use all Android targets" ) ;
7087const ndkVersionOption = new Option (
0 commit comments