This change will now allow for customizing the port number when running the metro server. The environment variable `RCT_METRO_PORT` can now be set when executing commands like `make run-ios`, `make run ios-device`, and `make run-android`. Though, it should be noted that `make clean` may need to be ran before attempting to set or change `RCT_METRO_PORT` since the react-native app will have statically built code that references the value of RCT_METRO_PORT from compile time and not runtime.
The killing of metro terminal upset a few people and this PR fixes that.
## Summary
Modify build step to check if metro is running already.
If so then we do not attempt to start metro again.
If not then we start metro after building android / iOS.
## Review notes
* case 1
- `make run-clojure`
- `make run-metro`
- `make run-android` or `make run-ios` should work the way it did before.
* case 2
- `make run-clojure`
- `make run-android` or `make run-ios` should also work.
## Platforms
- Android
- iOS
After upgrading `react-native` to `0.72.5` we frequently started seeing the _red screen of death_ on both `Android` and `iOS` simulators right after the app was built and installed.
This used to happen because our workflow required us to do the following :
- `make run-clojure`
- `make run-metro`
- `make run-ios` OR `make run-android`
The problem with this approach was after `metro` was started the `iOS`, `Android` build step would change the files that `metro` couldn't handle and hence metro would go out of sync.
The quick fix back then was to restart `metro` terminal and to open the app again from the simulator.
This was however not a good DX.
This commit fixes that.
We no longer rely on `react-native` cli to generate and deploy debug builds on simulators. We take control of the process via our own script. The new workflow introduced in this commit will first build the app, then install the app on the simulators and then start metro terminal. When `metro` is successfully running the script will then open the app.
The new workflow now is :
- `make run-clojure`
- `make run-ios` OR `make run-android`