|
1 | 1 | # @graphql-codegen/cli |
2 | 2 |
|
| 3 | +## 7.4.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- [#10928](https://github.com/dotansimha/graphql-code-generator/pull/10928) |
| 8 | + [`90229a5`](https://github.com/dotansimha/graphql-code-generator/commit/90229a5406ffeaa16422a0172340fcb53b94b1b9) |
| 9 | + Thanks [@eddeee888](https://github.com/eddeee888)! - Add |
| 10 | + `contentComparison?: 'cache-first' | 'disk'` to control disk-vs-cache write comparison in watch |
| 11 | + mode. |
| 12 | + |
| 13 | + In watch mode the CLI caches the hash of the content it last wrote per file and compares new |
| 14 | + output against that cached hash to skip redundant writes. This assumes generated output is a pure |
| 15 | + function of the codegen inputs. An output whose content depends on the file's existing content |
| 16 | + (e.g. a preset that reads the file and rewrites part of it) breaks that assumption: if the file is |
| 17 | + changed on disk and codegen regenerates content identical to a previous run, the cached hash still |
| 18 | + matches and the write is skipped, so the on-disk change is never corrected. |
| 19 | + |
| 20 | + `contentComparison: 'disk'` opts an output into comparing the generated content against the file |
| 21 | + on disk instead of the in-memory record of what codegen last wrote, so the file is rewritten when |
| 22 | + it was changed externally. It can be set: |
| 23 | + - by a preset, on the `GenerateOptions` it returns from `buildGeneratesSection`, or |
| 24 | + - on the output config (`generates[output].contentComparison`) for any output, including plain |
| 25 | + plugin outputs without a preset. |
| 26 | + |
| 27 | + When both are present, the preset's value takes precedence. The default, `'cache-first'`, keeps |
| 28 | + the existing in-memory-cache behaviour for outputs that are a pure function of their inputs. |
| 29 | + |
| 30 | +### Patch Changes |
| 31 | + |
| 32 | +- Updated dependencies |
| 33 | + [[`90229a5`](https://github.com/dotansimha/graphql-code-generator/commit/90229a5406ffeaa16422a0172340fcb53b94b1b9)]: |
| 34 | + - @graphql-codegen/plugin-helpers@7.3.0 |
| 35 | + |
3 | 36 | ## 7.3.1 |
4 | 37 |
|
5 | 38 | ### Patch Changes |
|
0 commit comments