rsw-rs

**`rsw = rs(rust) → w(wasm)`** - A command-line tool for automatically rebuilding local changes, based on the `wasm-pack` implementation. **Englist | [简体中文](./README.zh_CN.md)** ## Pre-installed - [rust](https://www.rust-lang.org/learn/get-started) - [nodejs](https://nodejs.org) - [wasm-pack](https://github.com/rustwasm/wasm-pack) ## Usage ```bash # Rust - install globally cargo install rsw ``` ```bash # help rsw -h # rsw.toml - initial configuration rsw init # generate a wasm project rsw new # dev mode rsw watch # release mode rsw build # clean - link & build rsw clean ``` ## Awesome rsw - [[rsw demo] learn-wasm](https://github.com/lencx/learn-wasm) - 🎲 Learning WebAssembly - [vite-plugin-rsw](https://github.com/lencx/vite-plugin-rsw) - 🦀 wasm-pack plugin for Vite - [create-mpl](https://github.com/lencx/create-mpl) - ⚡️ Create a project in seconds! - [Oh My Box](https://github.com/lencx/OhMyBox) - 🔮 Development toolbox, and more... ## Logger ```bash # @see: https://github.com/env-logger-rs/env_logger # RUST_LOG=rsw= rsw # 1. info RUST_LOG=rsw=info rsw # 2. all: info, trace, debug, error, warn RUST_LOG=rsw rsw ``` ### .watchignore Defines files/paths to be ignored. Similar to `.gitignore`. Example: ```bash # .watchignore *.js a/b/**/*.txt !a/b/**/main.txt ``` ## rsw.toml > configuration file - [TOML Doc](https://toml.io/en/) - [`wasm-pack build` Doc](https://rustwasm.github.io/docs/wasm-pack/commands/build.html) ### Options Create `rsw.toml` in the project root path, configure the `rust crate` parameter, and run the `rsw watch` or `rsw build` command. - **`name`** - Profile name (optional) - **`version`** - Profile version (optional) - **`interval`** - Development mode `rsw watch`, time interval for file changes to trigger `wasm-pack build`, default `50` milliseconds - **`cli`** - `npm` | `yarn` | `pnpm`, default is `npm`. Execute `link` using the specified `cli`, e.g. `npm link` - **`[new]`** - Quickly generate a crate with `wasm-pack new`, or set a custom template in `rsw.toml -> [new] -> using` - **`using`** - `wasm-pack` | `rsw` | `user`, default is `wasm-pack` - `wasm-pack` - `rsw new --template