apache / apache/cordova-ios

Allow to configure a default simulator instead of always using --target on `cordova run`

Open
#1,381 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.2k
Forks
999
Avg merge
12h 11m
Merged PRs (30d)
18

Description

Feature Request

Motivation Behind Feature

The current default, when npx cordova run ios is executed without a plugged device, is to get the latest iPhone on the available list of simulators (code). I'm not sure why this decision was taken - since it usually ends up being the latest, but also the largest one and the "easiest to have a good experience", let's say.

thanks Norman for the help figuring that out on Slack :)

That said, it's suboptimal to either force the developer to always specify a long and complex option (since device identifiers are never small), in case the latest and largest isn't the best for them.

Feature Description

My suggestion is to either have it read from a CLI variable (e.g. CORDOVA_DEFAULT_IOS_TARGET) or some other setting baked into the user or project config. The CLI variable might be more suitable since different devs might have different preferences among the same team, but a project-wide config could be useful as well, although I'm not sure where that would go (I'm kinda noob about the Cordova inner details).

That said, since I checked the code to see what goes on, I think I'm able to code whatever is agreed upon here, if this feature seems to makes sense :)

Alternatives or Workarounds

Just repeating the current --target option with a long string, or coding yourself a bash alias, which feels out of the workflow, may be forgotten by the user if they only run the application every now and then, and is not exactly obvious for newcomers on the team.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/build.js around line 84 and trace how cordova run ios selects a simulator when --target is absent. Review the existing CLI and project or user configuration paths before deciding where a default belongs; done means a configurable default target works while an explicit --target remains supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript, nodejs
Domain
cli, mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.