Repository navigation
fix(generate): delete autogen files for removed entities (#157) - #162
Merged
Merged
Conversation
apso generate only overwrote files, so entities removed or renamed in .apsorc left their entity, controller, service and DTO files in autogen/. Track every path a run writes, then delete files under autogen/ that carry the Apso header but were not written. Files without the header (.gitkeep, template seeds) and anything outside autogen/ are never touched. Cleanup is skipped when .apsorc has no entities. Closes #157
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #157.
What changed
apso generaterecords every path it writes. After generation, files under the autogen folder that carry the Apso header (Generated with Apso) but were not written this run are deleted, and each removal is printed. Directories left empty are removed..gitkeep, template seed__init__.py/routes.go, anything hand-placed) and everything outside autogen/ (includingextensions/) are never touched..apsorchas no entities, so a missing or empty schema cannot wipe generated code.generatehas no--dry-runflag, so none was added.Tests
test/commands/generate.test.tsruns the real command per language (TypeScript, Python, Go): generate Gadget + Widget, drop Widget, generate again. Widget files are gone, Gadget files are byte-identical,extensions/and an autogen.gitkeepare untouched. All 3 fail with cleanup disabled.