Skip to content

fix hermes path in case of single platform only#25

Open
revopushbot wants to merge 1 commit intomainfrom
issue-23
Open

fix hermes path in case of single platform only#25
revopushbot wants to merge 1 commit intomainfrom
issue-23

Conversation

@revopushbot
Copy link
Copy Markdown
Contributor

Fix: Hermes detection for iOS-only and Android-only projects

Fixes #23

Problem

release-react fails with [Error] Unable to find gradle file "android/app" when run on an iOS-only project that has no
android/ directory. The inverse problem also exists: an Android-only project fails because ios/Podfile is not found.

The root cause was that Hermes detection and Hermes binary resolution unconditionally attempted to read both platform's
config files, regardless of the target platform.

Changes (script/react-native-utils.ts)

isHermesEnabled() — now only invokes the check for the relevant platform. Previously it called both getAndroidHermesEnabled()
and getiOSHermesEnabled() on every invocation, causing an unnecessary cross-platform file read that could fail.

getiOSHermesEnabled() — when ios/Podfile is not found at its default path (no --podFile flag provided), falls back to the
React Native version heuristic (Hermes is the default engine since RN 0.70.0) instead of throwing. If the user explicitly
passed --podFile some/path and that file does not exist, the original clear error is still raised.

getHermesCommand() — wraps the getHermesCommandFromGradle() call in a try/catch so that missing gradle files (e.g. iOS-only
project) are silently skipped and resolution continues to the node_modules fallback chain.

parseBuildGradleFile() — wraps fs.lstatSync() in a try/catch so a completely missing android/ directory produces the existing
user-friendly error message instead of a raw ENOENT from Node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem with release-react for iOS project without an Android project: Unable to find gradle file "android/app"

2 participants