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

Better explanation of why generated code should be committed to version control #856

Open
pmcelhaney opened this issue Apr 16, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@pmcelhaney
Copy link
Owner

Is there any good reason to commit generated code for types to version control? In the documentation I wrote that those files should be committed, but now I can't remember what my reasoning was.

If the types code isn't committed, I think that would alleviate confusion when a new version of Counterfact generates types differently from the previous version.

Counterfact creates a .gitignore file for the .cache directory and that seems to work fine. I can't think of a reason we shouldn't add the types directories to that file.

@dethell
Copy link
Collaborator

dethell commented Apr 16, 2024

I would think just committing the components and paths would be enough. Types are ephemeral since they are regenerated anyway.

@pmcelhaney pmcelhaney changed the title Add types directories to .gitignore Better explanation of why generated code should be committed to version control Apr 16, 2024
@pmcelhaney
Copy link
Owner Author

Components are also types.

Okay, I remember the problem with not committing types. The moment you pull down the repo it's "broken" because there are references to type files that aren't there. In theory, you could run Counterfact and regenerate them in seconds. And the OpenAPI file might be outside of the repo, so there's no guarantee that running Counterfact again will produce exactly the same code.

I've changed the title of this issue to add more clarity in the documentation rather than change the code.

@pmcelhaney pmcelhaney added the documentation Improvements or additions to documentation label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants