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:
parent
fa07002352
commit
b139390deb
2 changed files with 7 additions and 2 deletions
5
.changeset/dirty-bees-repair.md
Normal file
5
.changeset/dirty-bees-repair.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@astrojs/upgrade': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixes an issue where `@astrojs/upgrade` announces integration updates for already up to date packages
|
|
@ -90,8 +90,8 @@ function filterPackages(ctx: Pick<Context, 'packages'>) {
|
||||||
const devDependencies: PackageInfo[] = [];
|
const devDependencies: PackageInfo[] = [];
|
||||||
for (const packageInfo of ctx.packages) {
|
for (const packageInfo of ctx.packages) {
|
||||||
const { currentVersion, targetVersion, isDevDependency } = packageInfo;
|
const { currentVersion, targetVersion, isDevDependency } = packageInfo;
|
||||||
// Remove prefix from `currentVersion` before comparing
|
// Remove prefix from version before comparing
|
||||||
if (currentVersion.replace(/^\D+/, '') === targetVersion) {
|
if (currentVersion.replace(/^\D+/, '') === targetVersion.replace(/^\D+/, '')) {
|
||||||
current.push(packageInfo);
|
current.push(packageInfo);
|
||||||
} else {
|
} else {
|
||||||
const arr = isDevDependency ? devDependencies : dependencies;
|
const arr = isDevDependency ? devDependencies : dependencies;
|
||||||
|
|
Loading…
Reference in a new issue