Skip to content

Commit 76c5fbd

Browse files
authoredOct 1, 2024··
Fix non-stable versions for astro add (#12095)
1 parent 12dae50 commit 76c5fbd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
 

‎.changeset/real-nails-tan.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Fix installing non-stable versions of integrations with `astro add`

‎packages/astro/src/cli/add/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,8 @@ async function resolveRangeToInstallSpecifier(name: string, range: string): Prom
608608
if (versions instanceof Error) return name;
609609
// Filter out any prerelease versions, but fallback if there are no stable versions
610610
const stableVersions = versions.filter((v) => !v.includes('-'));
611-
const maxStable = maxSatisfying(stableVersions.length !== 0 ? stableVersions : versions, range);
611+
const maxStable = maxSatisfying(stableVersions, range) ?? maxSatisfying(versions, range);
612+
if (!maxStable) return name;
612613
return `${name}@^${maxStable}`;
613614
}
614615

0 commit comments

Comments
 (0)
Please sign in to comment.