TheBevyFlock / bevy_cli

A Bevy CLI tool and linter.
https://thebevyflock.github.io/bevy_cli/
Apache License 2.0
48 stars 7 forks source link

Bevy run #120

Closed TimJentzsch closed 1 month ago

TimJentzsch commented 2 months ago

Add a bevy run command which conveniently runs your Bevy app.

It mostly wraps cargo run, but also provides a web sub command, which makes it a lot easier to target the browser.

This option will compile your app for WASM, create JS bindings, add an index.html file if you don't provide one yourself and serves the build locally to open it in your browser. The default index.html file is mostly what we had in bevy_quickstart.

This is the last part of #24. Closes #8.

Testing

  1. Checkout the bevy-run branch.
  2. Run cargo install --path . to install this version of the Bevy CLI.
  3. Navigate to your Bevy app.
  4. Run bevy run web.

Note that your app must be compatible with WASM. If you have features or profiles enabled by default which are not compatible with WASM, you need to disable them. E.g. bevy run --no-default-features web. If you have a custom index.html configured for trunk, it might also not work out of the box. You can try removing the entire web folder to try the default setup.

A good example project is of course bevy_new_2d, which you can test on this branch: https://github.com/TheBevyFlock/bevy_new_2d/pull/312