cli icon indicating copy to clipboard operation
cli copied to clipboard

Improve the developer experience of specifying device/simulator

Open warrenfalk opened this issue 2 years ago • 4 comments

Feature Description

Objective: Implement a mechanism allowing developers to specify personal preferences for devices/simulators without altering shared, version-controlled files.

Current Challenge: Developers often modify package.json to set device/simulator preferences, like so:

  "scripts": {
    "ios": "react-native run-ios --simulator 'iPad Air'"
  }

Such modifications, while useful for individual workflow (especially for those using multiple machines or working on various projects), can lead to unintended changes in shared files. This request aims to create a more flexible, non-disruptive way to set these preferences.

Proposed Implementations

Primary Suggestion: Utilize environment variables for local configuration of device and simulator preferences.

Environment Variables Example:

  • PREFERRED_IOS_DEVICES: A comma-separated list of devices (identified by UDID or name).

Preference Hierarchy:

  1. Command-line Arguments: Have the highest priority. If specified, these override other settings.
  2. Environment Variables: If no arguments are provided, the system should match an attached device or simulator (booted or not) from the environment variable list.
  3. Default Logic: If no matches are found in the above steps, revert to the standard logic (selecting the first attached device, booted simulator, or other fallbacks).

Extension to Android: A similar approach could be implemented for Android environments.

Related Issues

None identified.


warrenfalk avatar Jan 23 '24 17:01 warrenfalk

hey @warrenfalk! That sounds reasonable, and I think we can implement this! Would you like do it?

szymonrybczak avatar Jan 23 '24 22:01 szymonrybczak

@szymonrybczak, Yes, I'll send a PR

warrenfalk avatar Jan 23 '24 23:01 warrenfalk

(TIL if you put the issue number in your commit, then all amends to that commit will generate a comment on the issue 🤦🏻‍♂️ even if on a fork of the repo)

warrenfalk avatar Jan 25 '24 17:01 warrenfalk

There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.

github-actions[bot] avatar Apr 25 '24 03:04 github-actions[bot]

bumping this!!

I'd really like this feature and it seems like it's almost there 😃

m-rios avatar May 16 '24 14:05 m-rios