Help with tooling for writing a library

Hello!

Not sure if this is the right place to ask this.
I’ve been following reason/rescript for some time and I really like the language. I wanted to write a small utility library that can work with both react projects and node (UMD or ES module). Ideally I want to support both typescript(genType)/javascript as well as rescript projects.

how does one go about writing a library that can be used in a plain js/ts workflow AND contain rescript bindings? I’d really appreciate if some veterans could give me some pointers, a boilerplate would be even better.

Thanks

Hello! Yes, this is always the right place to ask questions =)

It depends on your use-case, so I’m not sure a catch-all boilerplate is what you need. What you’re doing is highly encouraged. As a rescript library that’s usable by plain js is free advertisement.

In general, keep the output js files open, and ensure that what you see is what you’d like to use on the JS consumer side. For module format, it’s your decision. Check in the output artifacts, or if you gitignore them, at least don’t npmignore them (since otherwise the JS consumers can’t see the artifacts). See here.