[rush] Fix issue where "rush update-autoinstaller" doesn't perform a full upgrade #4300
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.
Summary
While trying to resolve microsoft/rushstack-websites#193, I encountered a problem where
rush update-autoinstaller
was not performing a full upgrade, because it does not implementrush install
's workaround for pnpm/pnpm#1890.Details
rush update-autoinstaller
tries to force a clean reinstall by deletingpnpm-lock.yaml
, but PNPM has an unusual behavior where it tries to recover the deleted file using a backup copy from thenode_modules
folder. (Other package managers don't do that, but the issue notes explains an obscure use case that justifies it.) Rush works around this problem by deleting the backup file as well, butrush update-autoinstaller
is missing that logic.I also fixed a minor regression from PR #3391 where
_logIfConsoleOutputIsNotRestricted()
was printingundefined
instead of a blank line.How it was tested
How I reproed the issue:
rush prettier
to install therush-prettier
autoinstallerrush update-autoinstaller --name rush-prettier
. The lockfile version number is incremented, but no dependencies are upgraded. (Whereas if we skipped step 2, then a full upgrade would be performed.)Redoing step 3 with my PR build, the upgrade is performed successfully.
Impacted documentation
None.