「🌐 Language」简体中文

rsw = rs(rust) → w(wasm) - A command-line tool for automatically rebuilding local changes, based on the wasm-pack implementation.

rsw-rs

Feature

TODO

Pre-installed

Usage

```bash

Rust

cargo install rsw

Or Node.js

npm install -g @rsw/cli ```

```bash

help

rsw -h

rsw.toml - initial configuration

rsw init

generate a wasm project

rsw new

dev mode

rsw watch

release mode

rsw build ```

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 ```

rsw.toml

configuration file

Options

Create rsw.toml in the project root path, configure the rust crate parameter, and run the rsw watch or rsw build command.

Note: name in [[crates]] is required, other fields are optional.

rsw.log

watch info

Example

```toml

rsw.toml

name = "rsw" version = "0.1.0"

! default is 50 ms

interval = 50

! ---------------------------

! rsw new

[new]

! @see https://rustwasm.github.io/docs/wasm-pack/commands/new.html

! using: wasm-pack | rsw | user, default is wasm-pack

! 1. wasm-pack: rsw new <name> --template <template> --mode <normal|noinstall|force>

! 2. rsw: rsw new <name>, built-in templates

! 3. user: rsw new <name>, if dir is not configured, use wasm-pack new <name> to initialize the project

using = "wasm-pack"

! this field needs to be configured when using = "user"

! using = "wasm-pack" or using = "rsw", this field will be ignored

! copy all files in this directory

dir = "my-template"

! ################# NPM Package

! When there is only name, other fields will use the default configuration

! -------- package: rsw-hello --------

[[crates]] name = "rsw-hello"

! =======================================================

! -------- package: @rsw/hello --------

[[crates]]

#! npm package name

name = "@rsw/hello"

#! default is .

root = "."

#! default is pkg

out-dir = "pkg"

#! target: bundler | nodejs | web | no-modules, default is web

target = "web"

#! rsw watch

[crates.watch]

#! default is true

run = false

#! profile: dev | profiling, default is dev

profile = "dev"

#! rsw build

[crates.build]

run = false

#! profile: release | profiling, default is release

profile = "release"

```

License

MIT License © 2022 lencx