mirror of
https://git.um-react.app/um/lib_um_crypto_rust.git
synced 2026-03-08 04:29:54 +00:00
docs: add build instruction and npm usage
This commit is contained in:
36
README.MD
36
README.MD
@@ -12,6 +12,42 @@ lib_um_crypto_rust
|
|||||||
└── um_wasm_loader 打包 `um_wasm` 到 npm 包的代码。
|
└── um_wasm_loader 打包 `um_wasm` 到 npm 包的代码。
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 构建说明
|
||||||
|
|
||||||
|
```
|
||||||
|
bash build.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### 单独构建 um_wasm
|
||||||
|
|
||||||
|
首先安装 `wasm-pack`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
然后构建:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd um_wasm
|
||||||
|
wasm-pack build --release --target web
|
||||||
|
```
|
||||||
|
|
||||||
|
注意此处构建的产出不会被用于 NPM 包。
|
||||||
|
|
||||||
|
### 构建 NPM 包
|
||||||
|
|
||||||
|
安装 `wasm-pack` 以及 `pnpm`,然后构建:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd um_wasm_loader
|
||||||
|
pnpm build
|
||||||
|
```
|
||||||
|
|
||||||
|
## 作 NPM 包使用
|
||||||
|
|
||||||
|
参考 [`um_wasm_loader/Readme.MD`](um_wasm_loader/Readme.MD) 的说明。
|
||||||
|
|
||||||
## 授权协议
|
## 授权协议
|
||||||
|
|
||||||
Apache License 2.0 + MIT 双协议
|
Apache License 2.0 + MIT 双协议
|
||||||
|
|||||||
Reference in New Issue
Block a user