From cfff797f03300805e045ebbe010c61fad8ab11fc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Dec 2025 19:11:11 +0000 Subject: [PATCH 1/2] Initial plan From 9a35a69178bb3355c912d31b2d3f040c32070f21 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Dec 2025 19:20:23 +0000 Subject: [PATCH 2/2] fix: Write last-install.flag after update-autoinstaller completes Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com> --- libraries/rush-lib/src/logic/Autoinstaller.ts | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/libraries/rush-lib/src/logic/Autoinstaller.ts b/libraries/rush-lib/src/logic/Autoinstaller.ts index 8c35ea07b8..84fb06f243 100644 --- a/libraries/rush-lib/src/logic/Autoinstaller.ts +++ b/libraries/rush-lib/src/logic/Autoinstaller.ts @@ -265,6 +265,44 @@ export class Autoinstaller { } else { this._logIfConsoleOutputIsNotRestricted(Colorize.green('Already up to date.')); } + + // Write the last-install.flag file so that a subsequent "rush install-autoinstaller" + // will not perform a redundant install. + await this._createFlagsAsync(); + } + + private async _createFlagsAsync(): Promise { + const autoinstallerFullPath: string = this.folderFullPath; + + // Example: .../common/autoinstallers/my-task/.rush/temp + const lastInstallFlagPath: string = path.join( + autoinstallerFullPath, + RushConstants.projectRushFolderName, + 'temp' + ); + + const packageJsonPath: string = path.join(autoinstallerFullPath, 'package.json'); + const packageJson: IPackageJson = JsonFile.load(packageJsonPath); + + const lastInstallFlag: LastInstallFlag = new LastInstallFlag(lastInstallFlagPath, { + node: process.versions.node, + packageManager: this._rushConfiguration.packageManager, + packageManagerVersion: this._rushConfiguration.packageManagerToolVersion, + packageJson: packageJson, + rushJsonFolder: this._rushConfiguration.rushJsonFolder + }); + + // Create file: ../common/autoinstallers/my-task/.rush/temp/last-install.flag + await lastInstallFlag.createAsync(); + + // Example: ../common/autoinstallers/my-task/node_modules + const nodeModulesFolder: string = `${autoinstallerFullPath}/${RushConstants.nodeModulesFolderName}`; + const flagPath: string = `${nodeModulesFolder}/rush-autoinstaller.flag`; + + FileSystem.writeFile( + flagPath, + 'If this file is deleted, Rush will assume that the node_modules folder has been cleaned and will reinstall it.' + ); } private _logIfConsoleOutputIsNotRestricted(message?: string): void {