feat(pgpm): add --clobber flag for export command #506
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.
feat(pgpm): add --clobber flag for export command
Summary
This PR changes the
pgpm exportcommand to be non-destructive by default. Previously, exporting to an existing module would silently delete and recreate thedeploy/,revert/, andverify/directories. Now it throws an error unless the--clobberflag is explicitly provided.Key changes:
clobberoption toExportOptions,ExportMigrationsToDiskOptions, andPreparePackageOptionsinterfacespreparePackageto throw a descriptive error when module exists andclobber=false--clobberCLI flag topgpm exportcommand with help textReview & Testing Checklist for Human
pgpm exportoverwriting modules will now fail. Verify this is the intended behavior.pgpm exporttargeting an existing module without--clobberand verify the error message is clearpgpm export --clobberon an existing module and verify it overwrites correctlyRecommended test plan:
pgpm init workspacepgpm exportto create initial modulespgpm exportagain without--clobber→ should errorpgpm export --clobber→ should succeed and overwriteNotes
No unit tests were added for this new functionality - the existing test suite doesn't have database connectivity in CI to test the full export flow.
Link to Devin run: https://app.devin.ai/sessions/7e7813472a0643aa88ccb509b288050a
Requested by: Dan Lynch ([email protected]) @pyramation