-
Notifications
You must be signed in to change notification settings - Fork 7
Throw when no default targets are found #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a guard to error out when no default build triplets are found, instead of proceeding silently.
- Checks if
tripletsis empty and throws a user-facing error. - Moves the default-triplet info log into an
elsebranch.
Comments suppressed due to low confidence (1)
packages/cmake-rn/src/cli.ts:148
- [nitpick] Hyphenate 'platform-specific' and consider adding guidance on how to explicitly provide targets (e.g.,
--targets) to help users resolve this error.
"Found no default triplets: Install some platform specific build tools"
| throw new Error( | ||
| "Found no default triplets: Install some platform specific build tools" | ||
| ); |
Copilot
AI
Jun 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using commander’s program.error() or printing a clear message with console.error() followed by process.exit(1) instead of throwing a raw Error, to avoid exposing a stack trace in normal CLI usage.
| throw new Error( | |
| "Found no default triplets: Install some platform specific build tools" | |
| ); | |
| console.error( | |
| chalk.redBright("✖"), | |
| "Found no default triplets: Install some platform specific build tools" | |
| ); | |
| process.exit(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to postpone this to another PR copying the error handling from ferric somewhere shared between the different CLIs:
react-native-node-api/packages/ferric/src/build.ts
Lines 293 to 306 in d9e1a96
| if (error instanceof UsageError || error instanceof SpawnFailure) { | |
| console.error(chalk.red("ERROR"), error.message); | |
| if (error.cause instanceof Error) { | |
| console.error(chalk.red("CAUSE"), error.cause.message); | |
| } | |
| if (error instanceof UsageError && error.fix) { | |
| console.error( | |
| chalk.green("FIX"), | |
| error.fix.command | |
| ? chalk.dim("Run: ") + error.fix.command | |
| : error.fix.instructions | |
| ); | |
| } | |
| } else { |
Merging this PR will: