1.1.0 • Published 5 months ago
add-wasm2js v1.1.0
add-wasm2js
CLI tool to add wasm2js template to your wasm-pack project.
Prerequisites
Usage
First, create a new wasm-pack project:
wasm-pack new my-wasm-project cd my-wasm-project
Then, add wasm2js support:
npx add-wasm2js
This will create a wasm2js
directory in your project with:
- Frontend development environment
- Build scripts for wasm2js
- Development server setup
Testing Your WASM Module
After setup, you can test your WASM module:
cd wasm2js
npm run dev
The template includes a default "greet" function test. To test your own functions, modify frontend/src/main.ts
.
Project Structure
After running add-wasm2js
, your project will look like this:
my-wasm-project/ # Your wasm-pack project root
├── src/ # Rust source code
├── Cargo.toml
└── wasm2js/ # wasm2js specific files
├── frontend/ # Frontend code
│ └── src/
│ └── main.ts # Test your functions here
└── ...
Development
To contribute to this project:
- Clone the repository
- Install dependencies:
npm install
- Run tests:
npm test
Author
Yasuo Higa
- GitHub: @higayasuo
- X: @yasuo_higa
License
This project is licensed under the MIT License - see the LICENSE file for details.