-
Notifications
You must be signed in to change notification settings - Fork 237
Description
Description
Detection of whether hermes is enabled when doing codepush release-react may give incorrect results
Repro Steps
In our Podfile we had
use_react_native!(
:path => "../node_modules/react-native",
# :hermes_enables => true
)
but hermes was detected even with :hermes_enabled => true commented out.
Expected behavior
hermes to be detected as disabled
Details
The current behavior of getiOSHermesEnabled in src/commands/codepush/lib/react-native-utils.ts is not very robust:
const podFileContents = fs.readFileSync(podPath).toString();
return /(:hermes_enabled(\s+|\n+)?=>(\s+|\n+)?true|hermes_enabled:(\s+|\n+)?true)/.test(podFileContents);
In addition to the false positive I encountered, there are other simple cases in which this would break
use_hermes = true
use_react_native!(
:path => "../node_modules/react-native",
:hermes_enabled => use_hermes
)
There was a discussion about searching for hermes-engine in the Podfile.lock file instead in #1756, the possible downside being that this relies on Podfile.lock having being generated. If it is safe to assume that cocopods is installed another solution could be to search for hermes-engine in the generated json from pod ipc podfile-json <path to podfile>, though of course calling the cocoapods cli from js may have it's own concerns.