fix: pulling with env append to local files #13227
Merged
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.
Description of changes
Current behavior when running
amplify pull --appId <appId> --envName <env>
for an existing project is to move contents to a backup folder then create new local amplify files with the envName passed in as a pull parameter. This makes it seem like existing environments in the existing project are being overwritten by the new env pulled in.To address this, some updates were made to copy the amplify directory to the backup directory instead of moving the contents which will eventually be deleted in the cleanup process when the backup folder is removed. This will allow the newly pulled env to be added to the existing envs in
local-aws-info.json
.Issue #, if available
Description of how you validated changes
i. Observed
amplify pull --appId <appId> --envName <envName>
"overwrites" local-aws-info.json contents without fixii. Observed doing the same as above with fix appends envName to local-aws-info.json contents
Before Change
amplify pull
with appId and envNamedev
amplify pull
with appId and envNamedevtwo
After Change
amplify-dev pull
with appId and envNamedev
amplify-dev pull
with appId and envNamedevtwo
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.