From b139390deb738f96759cb787fe9e784be71f2134 Mon Sep 17 00:00:00 2001 From: Arpan Patel Date: Mon, 2 Dec 2024 08:38:05 -0600 Subject: [PATCH] fix(upgrade): enhance version comparison by normalizing `targetVersion` (#12577) --- .changeset/dirty-bees-repair.md | 5 +++++ packages/upgrade/src/actions/install.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/dirty-bees-repair.md diff --git a/.changeset/dirty-bees-repair.md b/.changeset/dirty-bees-repair.md new file mode 100644 index 0000000000..98fc2f714e --- /dev/null +++ b/.changeset/dirty-bees-repair.md @@ -0,0 +1,5 @@ +--- +'@astrojs/upgrade': patch +--- + +Fixes an issue where `@astrojs/upgrade` announces integration updates for already up to date packages diff --git a/packages/upgrade/src/actions/install.ts b/packages/upgrade/src/actions/install.ts index f031729e41..6e593b976b 100644 --- a/packages/upgrade/src/actions/install.ts +++ b/packages/upgrade/src/actions/install.ts @@ -90,8 +90,8 @@ function filterPackages(ctx: Pick) { const devDependencies: PackageInfo[] = []; for (const packageInfo of ctx.packages) { const { currentVersion, targetVersion, isDevDependency } = packageInfo; - // Remove prefix from `currentVersion` before comparing - if (currentVersion.replace(/^\D+/, '') === targetVersion) { + // Remove prefix from version before comparing + if (currentVersion.replace(/^\D+/, '') === targetVersion.replace(/^\D+/, '')) { current.push(packageInfo); } else { const arr = isDevDependency ? devDependencies : dependencies;