Skip to content

Commit

Permalink
fix(upgrade): enhance version comparison by normalizing `targetVersio…
Browse files Browse the repository at this point in the history
…n` (#12577)
  • Loading branch information
apatel369 authored Dec 2, 2024
1 parent fa07002 commit b139390
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-bees-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/upgrade': patch
---

Fixes an issue where `@astrojs/upgrade` announces integration updates for already up to date packages
4 changes: 2 additions & 2 deletions packages/upgrade/src/actions/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ function filterPackages(ctx: Pick<Context, 'packages'>) {
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;
Expand Down

0 comments on commit b139390

Please sign in to comment.