From 96456610d90cde818c827c2807ba7283ae52a25f Mon Sep 17 00:00:00 2001 From: jdalton Date: Thu, 12 Jun 2025 11:44:41 -0400 Subject: [PATCH] Avoid double installing for fix --- src/commands/fix/npm-fix.mts | 7 +++++-- src/commands/fix/pnpm-fix.mts | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/commands/fix/npm-fix.mts b/src/commands/fix/npm-fix.mts index e6dfbe155..13726e584 100644 --- a/src/commands/fix/npm-fix.mts +++ b/src/commands/fix/npm-fix.mts @@ -263,6 +263,7 @@ export async function npmFix( const editablePkgJson = await readPackageJson(pkgJsonPath, { editable: true, }) + const fixedVersions = new Set() let hasAnnouncedWorkspace = false let workspaceLogCallCount = logger.logCallCount @@ -301,12 +302,13 @@ export async function npmFix( ) continue infosLoop } - + if (fixedVersions.has(newVersion)) { + continue infosLoop + } if (semver.gte(oldVersion, newVersion)) { debugFn(`skip: ${oldId} is >= ${newVersion}`) continue infosLoop } - if ( activeBranches.find( b => @@ -379,6 +381,7 @@ export async function npmFix( await runScript(testScript, [], { spinner, stdio: 'ignore' }) } spinner?.success(`Fixed ${name} in ${workspace}.`) + fixedVersions.add(newVersion) } else { errored = true } diff --git a/src/commands/fix/pnpm-fix.mts b/src/commands/fix/pnpm-fix.mts index 16ed19b28..6cc00c831 100644 --- a/src/commands/fix/pnpm-fix.mts +++ b/src/commands/fix/pnpm-fix.mts @@ -365,6 +365,8 @@ export async function pnpmFix( const editablePkgJson = await readPackageJson(pkgJsonPath, { editable: true, }) + const fixedVersions = new Set() + // Get current overrides for revert logic. const oldPnpmSection = editablePkgJson.content[PNPM] as | StringKeyValueObject @@ -410,12 +412,13 @@ export async function pnpmFix( ) continue infosLoop } - + if (fixedVersions.has(newVersion)) { + continue infosLoop + } if (semver.gte(oldVersion, newVersion)) { debugFn(`skip: ${oldId} is >= ${newVersion}`) continue infosLoop } - if ( activeBranches.find( b => @@ -553,6 +556,7 @@ export async function pnpmFix( await runScript(testScript, [], { spinner, stdio: 'ignore' }) } spinner?.success(`Fixed ${name} in ${workspace}.`) + fixedVersions.add(newVersion) } else { errored = true }