Open reejosamuel opened 5 months ago
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.
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.