mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
Fix non-stable versions for astro add (#12095)
This commit is contained in:
parent
12dae50c77
commit
76c5fbd6f3
2 changed files with 7 additions and 1 deletions
5
.changeset/real-nails-tan.md
Normal file
5
.changeset/real-nails-tan.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix installing non-stable versions of integrations with `astro add`
|
|
@ -608,7 +608,8 @@ async function resolveRangeToInstallSpecifier(name: string, range: string): Prom
|
||||||
if (versions instanceof Error) return name;
|
if (versions instanceof Error) return name;
|
||||||
// Filter out any prerelease versions, but fallback if there are no stable versions
|
// Filter out any prerelease versions, but fallback if there are no stable versions
|
||||||
const stableVersions = versions.filter((v) => !v.includes('-'));
|
const stableVersions = versions.filter((v) => !v.includes('-'));
|
||||||
const maxStable = maxSatisfying(stableVersions.length !== 0 ? stableVersions : versions, range);
|
const maxStable = maxSatisfying(stableVersions, range) ?? maxSatisfying(versions, range);
|
||||||
|
if (!maxStable) return name;
|
||||||
return `${name}@^${maxStable}`;
|
return `${name}@^${maxStable}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue