cargo-run-wasm icon indicating copy to clipboard operation
cargo-run-wasm copied to clipboard

Add cli argument for using cargo-run-wasm within the same crate

Open FlorianUekermann opened this issue 3 years ago • 2 comments

I wanted to use cargo-run-wasm in a crate that wasn't part of a workspace. I can add the details to the readme, but I wanted to check if you are open to merging this before I do that.

The procedure is quite simple. You add an example called run-wasm.rs to the crate with the same main() as usual, but no Cargo.toml or directories. Then you add cargo-run-wasm to your dev-dependencies. The alias in the cargo config changes to run-wasm = "run --release --example run-wasm -- --same-crate" and that's it.

FlorianUekermann avatar Jul 08 '22 14:07 FlorianUekermann

Have you considered doing a single combined workspace and crate Cargo.toml like winit does? https://github.com/rust-windowing/winit/blob/master/Cargo.toml

I'm not ruling out this functionality yet but just want to better understand your use case.

I think that only supporting workspaces would help keep the complexity of cargo-run-wasm down. Its not the implementation complexity that im worried about but more the complexity of the documentation (readme.md)

rukai avatar Jul 10 '22 07:07 rukai

Thanks, that works for me. I didn't know you could mix crates and workspaces like that. I'm probably not the only one who would benefit from an explicit mention of this in the readme.

Feel free to close. I'm not sure this is a useful feature anymore.

FlorianUekermann avatar Jul 11 '22 14:07 FlorianUekermann

I added the suggested change to readme.

rukai avatar Oct 02 '22 00:10 rukai