Add a logic to remove out of date .pnpm-sync.json file during rush install or update
Upgrade pnpm-sync-lib to 0.2.8
Details
Problem
Normally, when users upgrade rush engine version, it won't clear the all existing node_modules cache, and rush will reuse these node_modules cache during rush install/update.
This could sometime causes a problem for pnpm-sync. Since .pnpm-sync.json is versioned, it should be regenerated even though the installation is up to date.
Also, in real practice, if a Monorepo is using feature based development flow, different branches can has different rush engine version, and if you switch between these branches, the node_modules won't be cleared and rush will try to resue the installation cache as well. This will also causes the problem that installation is up to date but .pnpm-sync.json is out of date.
These problems can be solved by rush purge, this will clear all node_modules folder, this action is expensive, though it is the correct way to do.
Solution
We can reposition the logic to generate the .pnpm-sync.json during rush install/update to solve the problem.
Now, .pnpm-sync.json will be ALWAYS regenerated no matter the rush install/update is skipped or not. In addition, every rush install/update action, we also check if there are out of date .pnpm-sync.json files, if yes, remove them.
Summary
.pnpm-sync.json
file during rush install or updatepnpm-sync-lib
to0.2.8
Details
Problem
Normally, when users upgrade rush engine version, it won't clear the all existing
node_modules
cache, and rush will reuse thesenode_modules
cache duringrush install/update
. This could sometime causes a problem for pnpm-sync. Since.pnpm-sync.json
is versioned, it should be regenerated even though the installation is up to date.Also, in real practice, if a Monorepo is using feature based development flow, different branches can has different rush engine version, and if you switch between these branches, the
node_modules
won't be cleared and rush will try to resue the installation cache as well. This will also causes the problem that installation is up to date but.pnpm-sync.json
is out of date.These problems can be solved by
rush purge
, this will clear allnode_modules
folder, this action is expensive, though it is the correct way to do.Solution
We can reposition the logic to generate the
.pnpm-sync.json
duringrush install/update
to solve the problem. Now,.pnpm-sync.json
will be ALWAYS regenerated no matter therush install/update
is skipped or not. In addition, everyrush install/update
action, we also check if there are out of date.pnpm-sync.json
files, if yes, remove them.How it was tested
Impacted documentation