Fix latest fetching prerelease versions. (#29)

* Fix fetching latest version to not fetch prerelease.

Signed-off-by: Kuba Martin <kubam@spacelift.io>

* Add tests.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

---------

Signed-off-by: Kuba Martin <kubam@spacelift.io>
Signed-off-by: Jakub Martin <kubam@spacelift.io>
This commit is contained in:
Kuba Martin authored and GitHub committed 2024-03-17 16:01:44 +01:00
1 parent d00c6817f1
commit ae80d4ecaa
3 files changed
+187 -6

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@ async function fetchReleases (githubToken) {
const semver = __nccwpck_require__(1383);
async function findLatestVersion (versions) {
return versions.sort((a, b) => semver.rcompare(a, b))[0];
return versions.filter((v) => semver.prerelease(v) === null).sort((a, b) => semver.rcompare(a, b))[0];
}
async function findLatestVersionInRange (versions, range) {