Rust & WASM - missing complete example

Hi all,

we've just added wasm support (just one function) to one of our crates. It works as a Rust crate and it also produces isomorphic (node & browser) NPM package that works nicely too. Crate is available here.

Interesting pieces:

What is the recommended way to organize a repo like this? Where do you put ...

  • node integration tests?
  • how do you pack isomorphic NPM package? we have it working, but it's a hack
  • how do you write / generate documentation for NPM package? where do you put it? seems that stuff like # Arguments isn't transformed at all, it's just passed through
  • do you share same README.md for both crates.io & npmjs.com?
  • do you test the whole crate functionality in the wasm bindgen tests too or do you just test small subset to see that bindings work?
  • what's your approach to test node integration? again, just a simple test that bindings work or do you test the whole crate functionality?

We made it somehow, but I think that it would be really helpful if some kind of complete example can be made. With complete I mean - tests, documentation (for both Rust & JS), building, publishing, ...

Anyway, any recommendations what we can improve here are more than welcome. How do you do it?

2 Likes