Skip to content

[rush] Fix an issue where the ability to skip 'rush install' may be incorrectly calculated when using the variants feature. #5022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Fix an issue where the ability to skip `rush install` may be incorrectly calculated when using the variants feature.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
2 changes: 1 addition & 1 deletion common/reviews/api/rush-lib.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,7 @@ export class Subspace {
// @beta
getPackageJsonInjectedDependenciesHash(variant?: string): string | undefined;
// @beta
getPnpmConfigFilePath(variant?: string): string;
getPnpmConfigFilePath(): string;
// @beta
getPnpmfilePath(variant?: string): string;
// @beta
Expand Down
8 changes: 3 additions & 5 deletions libraries/rush-lib/src/api/Subspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ export class Subspace {
public getPnpmOptions(): PnpmOptionsConfiguration | undefined {
if (!this._cachedPnpmOptionsInitialized) {
// Calculate these outside the try/catch block since their error messages shouldn't be annotated:
const subspaceConfigFolder: string = this.getSubspaceConfigFolderPath();
const subspaceTempFolder: string = this.getSubspaceTempFolderPath();
try {
this._cachedPnpmOptions = PnpmOptionsConfiguration.loadFromJsonFileOrThrow(
`${subspaceConfigFolder}/${RushConstants.pnpmConfigFilename}`,
this.getPnpmConfigFilePath(),
subspaceTempFolder
);
this._cachedPnpmOptionsInitialized = true;
Expand Down Expand Up @@ -207,7 +206,6 @@ export class Subspace {
* - Lockfiles: (i.e. - `pnpm-lock.yaml`, `npm-shrinkwrap.json`, `yarn.lock`, etc)
* - 'common-versions.json'
* - 'pnpmfile.js'/'.pnpmfile.cjs'
* - 'pnpm-config.js'
*/
public getVariantDependentSubspaceConfigFolderPath(variant: string | undefined): string {
const subspaceConfigFolderPath: string = this.getSubspaceConfigFolderPath();
Expand Down Expand Up @@ -303,8 +301,8 @@ export class Subspace {
* Example: `C:\MyRepo\common\subspaces\my-subspace\pnpm-config.json`
* @beta
*/
public getPnpmConfigFilePath(variant?: string): string {
return this.getVariantDependentSubspaceConfigFolderPath(variant) + '/' + RushConstants.pnpmConfigFilename;
public getPnpmConfigFilePath(): string {
return this.getSubspaceConfigFolderPath() + '/' + RushConstants.pnpmConfigFilename;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion libraries/rush-lib/src/logic/base/BaseInstallManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ export abstract class BaseInstallManager {
potentiallyChangedFiles.push(subspace.getCommonVersionsFilePath(variant));

// Add pnpm-config.json file to the potentially changed files list.
potentiallyChangedFiles.push(subspace.getPnpmConfigFilePath(variant));
potentiallyChangedFiles.push(subspace.getPnpmConfigFilePath());

if (this.rushConfiguration.packageManager === 'pnpm') {
// If the repo is using pnpmfile.js, consider that also
Expand Down
Loading