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

Add contributing architecture doc #467

Merged
merged 4 commits into from
Sep 14, 2023
Merged

Conversation

jeffcharles
Copy link
Collaborator

Wanted to get some feedback on what I have so far for a contributing architecture document. We can also merge and create additional PRs to revise so we have something if what's in here is good on its own but we want to add more.

Copy link
Member

@saulecabrera saulecabrera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The direction looks good to me.

Are you planning on adding examples to some of the sections? For example:

javy-apis

Common JS APIs for use with a javy::Runtime. For example, console, TextEncoder, TextDecoder. If there is a standard JS API that seems like it would be useful to multiple users of Javy, it should be implemented in this crate. If this is an API specific to your use case, you should define it in a crate of your own and register the implementation using a similar approach to how the APIs in this crate define their implementations.

Adding an API implementation

  1. Add a feature to the crate's Cargo.toml for your module.
  2. Create a directory under src with a mod.rs file.
  3. If your API implementation requires configuration, create a configuration struct for the configuration properties required in your module.
  4. In mod.rs, implement the crate::JSApiSet trait. If your API requires configuration, add the configuration struct defined earlier to the crate::ApiConfig struct under a #[cfg(feature = "your feature name")] attribute.
  5. If necessary, add any JS source files inside the module you're adding.
  6. Add the mod to the crate's lib.rs under a #[cfg(feature = "your feature name")] attribute.
  7. Add a call to your struct's register method under a #[cfg(feature = "your feature name")] in lib.rs's add_to_runtime function.

I think that those two sections could be clearer if they had some examples.

@jeffcharles jeffcharles marked this pull request as ready for review September 13, 2023 15:51
@jeffcharles jeffcharles changed the title Start of contributing architecture doc Add contributing architecture doc Sep 14, 2023
@jeffcharles jeffcharles merged commit 5189b9a into main Sep 14, 2023
14 checks passed
@jeffcharles jeffcharles deleted the jc.add-contributing-architecture branch September 14, 2023 15:23
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 this pull request may close these issues.

2 participants