[native] Patch @expo/cli to display dev-server IP
Summary:
Related: https://linear.app/comm/issue/ENG-2705/expo-cli-qr-code-doesnt-use-the-right-lan-ip-address
Because we run expo start with the --dev-client flag, but we don't have defined a custom Linking URL Scheme, Expo CLI defaults to localhost.
This diff patches @expo/cli and overrides this behavior.
- Try to autodetect the IP using some utility from the package
- If failed, try to read the IP from native/facts/network.json
- If we fail again (require fails or natDevHostname doesn't exist), leave "localhost"
On the other hand, maybe it's worth stopping relying on network.json, as stated in https://linear.app/comm/issue/ENG-2707/replace-nativefactsnetworkjson-with-code-that-detects-lan-ip-address
Test Plan:
cd native yarn dev
The IP should display instead of http://localhost:8081 and QR code should be scannable (it should open some Expo/Metro-specific JSON in the browser)
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: tomek, atul
Differential Revision: https://phab.comm.dev/D6257