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

Avoid File Overwriting for Unchanged Files #3364

Open
reejosamuel opened this issue Apr 5, 2024 · 1 comment
Open

Avoid File Overwriting for Unchanged Files #3364

reejosamuel opened this issue Apr 5, 2024 · 1 comment
Labels
codegen Issues related to or arising from code generation feature New addition or enhancement to existing solutions

Comments

@reejosamuel
Copy link

Use case

Prevent the overwriting of files during code generation if they have not changed. This is crucial for CI tooling relying on file modification dates for tasks like cache busting and triggering code generation using tools like Sourcery.

Describe the solution you'd like

Introduce a configuration option to control overwriting unchanged files, or by default, prevent such overwriting.

@reejosamuel reejosamuel added the feature New addition or enhancement to existing solutions label Apr 5, 2024
@calvincestari
Copy link
Member

Hi @reejosamuel, thanks for the feature suggestion.

I think to make this work we'd have to introduce a checksum of the file body that is written into generated files as a header comment. Currently the overwrite logic is very simplistic and comes down to whether the generated file is one that we allow user edits, such as the schema configuration and custom scalars. If yes then leave the file alone, if no then overwrite it. There is no tracking of generated file diffs at the moment.

@calvincestari calvincestari added the codegen Issues related to or arising from code generation label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codegen Issues related to or arising from code generation feature New addition or enhancement to existing solutions
Projects
None yet
Development

No branches or pull requests

2 participants