mirror of
https://github.com/MillironX/setup-nextflow.git
synced 2024-11-25 18:59:55 +00:00
refactor: Move nextflow_bin_url function to NextflowRelease.ts
Nextflow binary URLs should be stored in the new NextflowRelease object, so it should essentially be private for the NextflowRelease type. Move the function to that file to signify that (but retain export for testing purposes).
This commit is contained in:
parent
7cc27d1095
commit
a97128956e
2 changed files with 20 additions and 14 deletions
|
@ -7,3 +7,23 @@ export type NextflowRelease = {
|
|||
binaryURL: string
|
||||
allBinaryURL: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the download URL of a Nextflow binary
|
||||
* @param release A "release" data struct from OctoKit
|
||||
* @param get_all Whether to return the url for the "all" variant of Nextflow
|
||||
* @returns The URL of the Nextflow binary
|
||||
*/
|
||||
export function nextflow_bin_url(release: object, get_all: boolean): string {
|
||||
const release_assets = release["assets"]
|
||||
const all_asset = release_assets.filter((a: object) => {
|
||||
return a["browser_download_url"].endsWith("-all")
|
||||
})[0]
|
||||
const regular_asset = release_assets.filter((a: object) => {
|
||||
return a["name"] === "nextflow"
|
||||
})[0]
|
||||
|
||||
const dl_asset = get_all ? all_asset : regular_asset
|
||||
|
||||
return dl_asset.browser_download_url
|
||||
}
|
||||
|
|
|
@ -72,20 +72,6 @@ export async function release_data(
|
|||
return matching_releases[0]
|
||||
}
|
||||
|
||||
export function nextflow_bin_url(release: object, get_all: boolean): string {
|
||||
const release_assets = release["assets"]
|
||||
const all_asset = release_assets.filter((a: object) => {
|
||||
return a["browser_download_url"].endsWith("-all")
|
||||
})[0]
|
||||
const regular_asset = release_assets.filter((a: object) => {
|
||||
return a["name"] === "nextflow"
|
||||
})[0]
|
||||
|
||||
const dl_asset = get_all ? all_asset : regular_asset
|
||||
|
||||
return dl_asset.browser_download_url
|
||||
}
|
||||
|
||||
export async function install_nextflow(
|
||||
url: string,
|
||||
version: string
|
||||
|
|
Loading…
Reference in a new issue