The language for wasm
I chose Rust language for web-assembly. I knew that rust could generate web-assembly. I was interested in the rust language at that time. Because I saw an article said Rust is in higher ranking among software developers. In my opinion, it is like modern style c++ language. Rust has standard package manager “Cargo”. The cargo manage dependencies some libraries for your app or library. It is just like npm in node, composer in php or pip in python. You don’t have to prepare some libraries in your system by hand.
Run wasm-bindgen after build lib
You need to run wasm-bindgen after you build library as wasm32-unkonwn-unknown. Wasm-bindgen seemed to get some informantion from the library to build web-assembly and type declaration file. I tried to find Cargo standard way to run some command after build library, but I could not. Cargo offers only the way to run some commands before you build library. I find some Cargo tools to run after you build library. I found “cargo-make” to do my requirement but I have to learn another syntax about it. It’s ok at that time. But I would forget the syntax 6 months later for the another language project I focus on. I would like to use rust language to run some custom commands after you build a library. I found a discussion about post running commands on Cargo build system. I thought that it take long time to make Cargo have the way to run some commands automatically after cargo build. In the discussion, I found “xtask” idea. The xtask is not a tool like cargo-make. It is the way to make cargo run additional tasks. The xtask is a workspace for cargo. It is nice for me to run some custom tasks with cargo. I could use rust language to make custom task.
Release web-assembly and use it
I could push my project on github.com and release the web-assembly in npm package directory. The library is used in Mine sweeper app now.