Skip to content

Commit

Permalink
[rush] fix: ignore flags when doing install with resolution only (mic…
Browse files Browse the repository at this point in the history
…rosoft#4907)

* fix: ignore flags when doing install with resolution only

* add changeset

* remove console.log

---------

Co-authored-by: Aramis Sennyey <[email protected]>
  • Loading branch information
aramissennyeydd and aramissennyeydd authored Aug 28, 2024
1 parent b5e3f20 commit eada3ce
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Fix an issue where running `rush install --resolution-only` followed by `rush install` would not actually install modules.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
29 changes: 20 additions & 9 deletions libraries/rush-lib/src/logic/base/BaseInstallManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ export abstract class BaseInstallManager {
}

public async doInstallAsync(): Promise<void> {
const { allowShrinkwrapUpdates, selectedProjects, pnpmFilterArgumentValues } = this.options;
const { allowShrinkwrapUpdates, selectedProjects, pnpmFilterArgumentValues, resolutionOnly } =
this.options;
const isFilteredInstall: boolean = pnpmFilterArgumentValues.length > 0;
const useWorkspaces: boolean =
this.rushConfiguration.pnpmOptions && this.rushConfiguration.pnpmOptions.useWorkspaces;
Expand Down Expand Up @@ -202,7 +203,13 @@ export abstract class BaseInstallManager {
return this.canSkipInstall(outputStats.mtime, subspace);
};

if (cleanInstall || !shrinkwrapIsUpToDate || !canSkipInstall() || !projectImpactGraphIsUpToDate) {
if (
resolutionOnly ||
cleanInstall ||
!shrinkwrapIsUpToDate ||
!canSkipInstall() ||
!projectImpactGraphIsUpToDate
) {
// eslint-disable-next-line no-console
console.log();
await this.validateNpmSetupAsync();
Expand All @@ -224,12 +231,14 @@ export abstract class BaseInstallManager {
}
}

// Delete the successful install file to indicate the install transaction has started
await commonTempInstallFlag.clearAsync();
if (!resolutionOnly) {
// Delete the successful install file to indicate the install transaction has started
await commonTempInstallFlag.clearAsync();

// Since we're going to be tampering with common/node_modules, delete the "rush link" flag file if it exists;
// this ensures that a full "rush link" is required next time
await this._commonTempLinkFlag.clearAsync();
// Since we're going to be tampering with common/node_modules, delete the "rush link" flag file if it exists;
// this ensures that a full "rush link" is required next time
await this._commonTempLinkFlag.clearAsync();
}

// Give plugins an opportunity to act before invoking the installation process
if (this.options.beforeInstallAsync !== undefined) {
Expand Down Expand Up @@ -347,8 +356,10 @@ export abstract class BaseInstallManager {
// Perform any post-install work the install manager requires
await this.postInstallAsync(subspace);

// Create the marker file to indicate a successful install
await commonTempInstallFlag.createAsync();
if (!resolutionOnly) {
// Create the marker file to indicate a successful install
await commonTempInstallFlag.createAsync();
}

// Give plugins an opportunity to act after a successful install
if (this.options.afterInstallAsync !== undefined) {
Expand Down

0 comments on commit eada3ce

Please sign in to comment.