rushstack
rushstack copied to clipboard
[rush-lib] Fix an bug when using pnpm 9, where a subspace is empty, the rush install fails
trafficstars
Summary
When using PNPM 9, if a subspace is empty. The rush install will throw follow error:
The shrinkwrap file has not been updated to support workspaces. Run "rush update --full" to update the shrinkwrap file.
However, after rush update --full, then rush install, the error still there.
This is due to, the isWorkspaceCompatible logic does not consider the empty lockfile case.
Here is the current logic:
this.isWorkspaceCompatible =
this.shrinkwrapFileMajorVersion >= ShrinkwrapFileMajorVersion.V9
? this.importers.size > 1
: this.importers.size > 0;
In a empty lockfile, the importers.size = 1, so I think we will need to change this logic to this.isWorkspaceCompatible = this.importers.size > 0
How it was tested
Manually tested with rush repo locally.
Impacted documentation
N/A