0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00

fix(upgrade): enhance version comparison by normalizing targetVersion (#12577)

This commit is contained in:
Arpan Patel 2024-12-02 08:38:05 -06:00 committed by GitHub
parent fa07002352
commit b139390deb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/upgrade': patch
---
Fixes an issue where `@astrojs/upgrade` announces integration updates for already up to date packages

View file

@ -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;