「🌐 Language」简体中文
rsw = rs(rust) → w(wasm)
- A command-line tool for automatically rebuilding local changes, based on the wasm-pack
implementation.
wasm-pack
rsw
user
vite
, webpack
, etc.bash
cargo install rsw
```bash
rsw -h
rsw watch
rsw build ```
```bash
RUST_LOG=rsw=info rsw
RUST_LOG=rsw rsw
configuration file
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[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 <name> --template <template> --mode <normal|noinstall|force>
wasm-pack new docrsw
- rsw new <name>
, built-in templatesuser
- rsw new <name>
, if dir
is not configured, use wasm-pack new <name>
to initialize the project.dir
- Copy all files in this directory. This field needs to be configured when using = "user"
. using = "wasm-pack"
or using = "rsw"
, this field will be ignored[[crates]]
- Is an array that supports multiple rust crate
configurations
name
- npm package name, supporting organization, e.g. @rsw/foo
root
- Relative to the project root path, default is .
target
- bundler
| nodejs
| web
| no-modules
, default is web
out-dir
- npm package output path, default pkg
[crates.watch]
- Development moderun
- Whether this crate
needs to be watching, default is true
profile
- dev
| profiling
, default is dev
[crates.build]
- Production moderun
- Whether this crate
needs to be build, default is true
profile
- release
| profiling
, default is release
Note: name
in [[crates]]
is required, other fields are optional.
```toml
name = "rsw" version = "0.1.0"
50
msinterval = 50
[new]
wasm-pack
| rsw
| user
, default is wasm-pack
rsw new <name> --template <template> --mode <normal|noinstall|force>
rsw new <name>
, built-in templatesrsw new <name>
, if dir
is not configured, use wasm-pack new <name>
to initialize the projectusing = "wasm-pack"
using = "user"
using = "wasm-pack"
or using = "rsw"
, this field will be ignoreddir = "my-template"
name
, other fields will use the default configuration[[crates]] name = "rsw-hello"
.
pkg
web
true
dev
| profiling
, default is dev
release
| profiling
, default is release
```
MIT License © 2022 lencx