feat(run-ios): allow passing UDID inside `--device` option
Summary:
We have bunch of options to provide a target to run app on:
→ --device,
→ --simulator,
→ --udid.
It creates some misconception for users, where one flag works as expected in theory but user think that it's not working since they may don't know about other options.
In this Pull Request I've improved experience of using --device flag in run-ios function (I'll add run-android implementation in separate Pull Request). From now --device accepts device name and unique device identifier and also checks if target device is maybe a simulator to give an appropriate error message to guide user what they should use.
Test Plan:
- Clone the repository and do all the required steps from the Contributing guide
- This command
node /path/to/react-native-cli/packages/cli/build/bin.js run-ios --device "iPhone Szymon"
should run app on physical device. 3. This command
node /path/to/react-native-cli/packages/cli/build/bin.js run-ios --device "XYZ-UDID-PHYSICAL"
should run app also on physical device (the same behaviour as with device name). 4. This command (iPhone 15 is a simulator)
node /path/to/react-native-cli/packages/cli/build/bin.js run-ios --device "iPhone 15"
should throw the error: 5. This command ("XYZ-UDID-SIMULATOR" is a simulator's UDID)
node /path/to/react-native-cli/packages/cli/build/bin.js run-ios --device "XYZ-UDID-SIMULATOR"
should also throw the error:
Checklist
- [x] Documentation is up to date to reflect these changes.
- [x] Follows commit message convention described in CONTRIBUTING.md