From 5a5c42e549cf689c48e440d7f94d85117e621a06 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sat, 23 Dec 2023 10:42:54 -0700 Subject: [PATCH] refactor: Make get_nextflow_release work using NextflowRelease objects --- src/functions.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/functions.ts b/src/functions.ts index 940386a..3a5aa85 100644 --- a/src/functions.ts +++ b/src/functions.ts @@ -34,11 +34,17 @@ function tag_filter(version: string): (r: NextflowRelease) => Boolean { return filter } - const matching_releases = all_releases.filter(filter) +export async function get_nextflow_release( + version: string, + releases: NextflowRelease[] +): Promise { + // Filter the releases + const filter = tag_filter(version) + const matching_releases = releases.filter(filter) matching_releases.sort((x, y) => { // HACK IDK why the value flip is necessary with the return - return semver.compare(x["tag_name"], y["tag_name"], true) * -1 + return semver.compare(x.versionNumber, y.versionNumber, true) * -1 }) return matching_releases[0]