Write newContent to filePath only when the file is missing or the bytes differ.
Unchanged generated files keep their mtime. That is the whole point on a 2,000-entity
database: TypeScript incremental builds (incremental: true) and file watchers treat
a rewritten-but-identical monolith as dirty and recompile it. Skipping the write is
what makes per-schema emit actually cheap on a no-op CodeGen run.
Deliberately dependency-free (no util / config import) so unit tests can exercise
it without booting the CodeGen config graph.
Write
newContenttofilePathonly when the file is missing or the bytes differ.Unchanged generated files keep their mtime. That is the whole point on a 2,000-entity database: TypeScript incremental builds (
incremental: true) and file watchers treat a rewritten-but-identical monolith as dirty and recompile it. Skipping the write is what makes per-schema emit actually cheap on a no-op CodeGen run.Deliberately dependency-free (no
util/ config import) so unit tests can exercise it without booting the CodeGen config graph.