HipsterBrown / xs-dev

The quickest way for getting started with JS on devices
https://xs-dev.js.org
MIT License
41 stars 13 forks source link

Discover supported devices for interactive `--list-devices` #175

Closed HipsterBrown closed 2 months ago

HipsterBrown commented 2 months ago

The list of available devices that may be selected when passing the --list-devices flag to any of the "build" related commands (run, build, clean, debug) is currently static: https://github.com/HipsterBrown/xs-dev/blob/main/src/toolbox/build/index.ts#L63-L123

This means updating it anytime more devices are added to Moddable SDK, whether or not someone using xs-dev has updated to the latest version of the SDK.

To keep this flag more future-proof than it is today, we can use the same strategy as discovering example projects by searching through the directories of $MODDABLE/build/devices/{device_name}/targets. This search could also be slightly clever by only searching through directories of supported platforms based on querying the development environment, like this.

This should also include the $MODDABLE/build/simulators, the host dev environment (mac, linux, windows), and wasm by default.