Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm package for orderbook that uses existing rust crates #746

Closed
3 tasks done
hardyjosh opened this issue Jul 30, 2024 · 0 comments · Fixed by #751
Closed
3 tasks done

npm package for orderbook that uses existing rust crates #746

hardyjosh opened this issue Jul 30, 2024 · 0 comments · Fixed by #751
Assignees

Comments

@hardyjosh
Copy link
Contributor

hardyjosh commented Jul 30, 2024

Problem

We are starting to build applications now with JS/TS for the Raindex app. A lot of the functionality needed for these apps has already been built as part of Raindex, however the code is Rust.

Ideally we would:

  • resuse as much of the same code as possible
  • only have one place to maintain the core functionality required for the Raindex app, CLI applications and JS applications.

Solution

Set up an NPM package for Raindex that is a thin wrapper on our existing crates. It doesn't need all of the functionality that we already have, just a clear path/pattern to follow, and we can add things as we need.

However, the first thing we need is a function that takes:

  • a dotrain order with frontmatter YAML following the order spec
  • a deployment (just the name as a string)
  • any binding overrides

@rouzwelt can you please flesh out the plan for this?

  • firstly need to figure out a way move things into segments with optional deps and using cfg flags to be able to build for a wasm32 target, that would include to ideally isolate the main functionalities required for this scope in a way that a wasm32 target can be built, that is most important and difficult part, we need to make all of rain repos that deps washable as the first part of this, ie all of our repos that deps should be able to build for wasm individually, and then we can try wasming the ob crates
  • next we would need to build an js API for it, something similar that we have in dotrain, might not be necessarily necessary for this scope depending on how easily we can bring the things into wasm bindgen.
  • lastly need to have a proper npm package setup and also formatting the final js/ts output to be esm/cjs compatible (example of that is dotrain), as well as some js test and a npm build script

todo:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants