Graphite icon indicating copy to clipboard operation
Graphite copied to clipboard

Reenable Specta integration

Open oscartbeaumont opened this issue 9 months ago • 8 comments

This fixes the commented out Specta integration resolving the TODO comment.

It might be worth moving the type exporting code into the startup of the application if possible when doing a debug build so that you don't need to run cargo test ... to generate the bindings but I don't know enough about Graphite's setup to know where is best. I also suppose any Rust running in wasm would not be a good place for that as it won't have filesystem access so a better place may not exist.

TODO:

  • [ ] Decide on approach
  • [ ] Fix the errors with linter (we can do that from the Specta side)

Part of #1148

oscartbeaumont avatar Mar 14 '25 11:03 oscartbeaumont

Thank you for writing the library and helping us restore this! I'm eager to do the refactor which replaces messages.ts with these generated bindings.

Keavon avatar Mar 14 '25 11:03 Keavon

Back to reviewing this now! Could you please help me understand the purpose of pnpm-lock.yaml, bindings_from_node.ts, and export.js?

Keavon avatar May 02 '25 01:05 Keavon

I also removed the pnpm-lock.yaml. It was just from me using pnpm instead of npm.

oscartbeaumont avatar May 02 '25 18:05 oscartbeaumont

It might be worth moving the type exporting code into the startup of the application if possible when doing a debug build so that you don't need to run cargo test ... to generate the bindings but I don't know enough about Graphite's setup to know where is best.

We can build the specta types in a build.rs eliminating the need to run cargo test which is pretty obscure and would probably lead to issues down the line

TrueDoctor avatar May 20 '25 07:05 TrueDoctor

Be aware that will require either:

  • Running nested cargo builds which is not supported due to the lock on the cargo directory, or
  • Splitting all of your types into a different crate than the one with the build.rs so it can import the types as a build dependency.

oscartbeaumont avatar May 20 '25 09:05 oscartbeaumont

* Splitting all of your types into a different crate than the one with the `build.rs` so it can import the types as a build dependency.

Yeah, was thinking that we could put the build script in the frontend editor-wasm projects which uses the editor crate as its dependency. We thus have access to all types and have them in a separate crate

TrueDoctor avatar May 20 '25 09:05 TrueDoctor

That sounds great!

oscartbeaumont avatar May 20 '25 13:05 oscartbeaumont

We just need to reexport the specta types static global from the editor so we can consume in then the wasm crate but that is easy to do

TrueDoctor avatar May 21 '25 11:05 TrueDoctor