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

move generated bindings files to a generated/ sub-directory #315

Open
yoshuawuyts opened this issue Jun 28, 2024 · 2 comments · May be fixed by #316
Open

move generated bindings files to a generated/ sub-directory #315

yoshuawuyts opened this issue Jun 28, 2024 · 2 comments · May be fixed by #316

Comments

@yoshuawuyts
Copy link
Member

This is a small pet-peeve of mine but I figured I'd raise it: I find the name src/bindings.rs to be a little ambiguous, as it assumes people are already familiar with how WIT, Wasm Components, and wasm-bindgen work. It also assumes that people seeing the file in the hierarchy understand that this was auto-generated and was not checked in by hand. I feel like we would be better served by clearer labeling that this file is automatically generated, and specific to Wasm Components - not just any old bindings. This is doubly the case when we consider that people might generate bindings to other things, for example: it's not unreasonable for someone to generate bindings to a protobuf schema, and then wire that over wasi:sockets.

What I'm proposing here are two relatively minor changes:

  1. Create a directory called src/generated/ which we recommend using as the output target for all generated code.
  2. Rename the bindings.rs file to something slightly more descriptive. Something like wasm_bindings or component_bindings could more clearly clue in people unfamiliar with Wasm Components about what is going on.

If we put those two together, that would result in a rename like src/bindings.rssrc/generated/component_bindings.rs. A little longer, but more clearly factored in a way that makes it clear we're not supposed to edit this by hand.

This is clearly a "what color do we paint the bike shed" type of question, which is why I've put this off raising this for a while. But it feels like we're in the home stretch of delivering an end-to-end story, and I've recently seen at least one person be confused about the purpose of bindings.rs, so I figured raising this now might actually be reasonable timing.

@calvinrp
Copy link
Collaborator

I'm a fan of this. Agree that it could make this less confusing and more organized. PRs welcome

@iawia002 iawia002 linked a pull request Jul 3, 2024 that will close this issue
@iawia002
Copy link
Contributor

iawia002 commented Jul 3, 2024

+1 for this idea, I have submitted a PR (#316) for this, Please take a look if this is what we want.

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.

3 participants