Creating larger bindings project

When I create bindings, I typically have one file with all the bindings to a specific node package.
This works fine, but now I have a lot of bindings and a lot of nested modules.
It feels like I’m over the threshold to start splitting things up.

How would one approach this?
Very specific, I’m considering splitting up rescript-snake/src/Kaplay.res at main · nojaf/rescript-snake · GitHub.

Do I create a new project, add a namespace property and just split things up into files?
Do the file names need something unique? Or would the namespace solve that problem?

I’m considering creating a monorepo using rewatch. So, I polish my binding for re-use and publication, yet I do keep a strong focus on everything still working for my project. I’m intrigued by that idea.

Happy to hear your suggestions.

Not specifically for bindings, but when I have a lot of nested modules inside a “main” module, I start to create files like Kaplay_Collision.res, Kaplay_Math, etc. and reexport (not allways) these submodules inside a main module (Kaplay.res).

I tried also the monorepo approach with rewatch, but had some trouble while using custom jsx transforms :frowning:

1 Like

Monorepo for sure, define your submodules as different modules and use namespace: true in the rescript.json

packages
  snake
    src
      Snake.res
  kaplay
    src
      Debug.res
      Vec2.res
      PosComp.res