set deduplication doesn't work, sadly, with SemVers.

Without this, .tar.gz and .tar.xz generate the same version line twice.
This commit is contained in:
Jacob Heider 2022-09-29 16:53:44 -04:00
parent 3d322f2701
commit c84df235dc

View file

@ -95,11 +95,12 @@ async function get_versions(key: string, pkg: Package): Promise<SemVer[]> {
.map(x => basename(x)) .map(x => basename(x))
.filter(x => x.match(/v.*\.tar\.gz$/)) .filter(x => x.match(/v.*\.tar\.gz$/))
.map(x => x.replace(/v(.*)\.tar\.gz/, "$1")) .map(x => x.replace(/v(.*)\.tar\.gz/, "$1"))
.compact(semver.parse)
?? [] ?? []
// have to add pkg.version as put and get are not atomic // have to add pkg.version as put and get are not atomic
return [...new Set([...got, pkg.version])].sort(semver.compare) return [...new Set([...got, pkg.version.toString()])]
.compact(semver.parse)
.sort(semver.compare)
} }
function assert_pkg(pkg: Package | PackageRequirement) { function assert_pkg(pkg: Package | PackageRequirement) {