From cb4eba1352057a7d1a3342c8cce1b6b36bbb967e Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Mon, 17 Jan 2022 21:02:37 +0100 Subject: [PATCH] fix: remove double resolving package versions --- build/setup/index.js | 17 ++++++++--------- src/actions/setup.ts | 17 ++++++++--------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/build/setup/index.js b/build/setup/index.js index d0a6d2a3..a2985c8d 100644 --- a/build/setup/index.js +++ b/build/setup/index.js @@ -65230,7 +65230,7 @@ async function setupAction(input = setupInput()) { const message = input.easCache ? `Installing eas-cli (${version}) from cache or with ${input.packager}` : `Installing eas-cli (${version}) with ${input.packager}`; - await (0, core_1.group)(message, () => installCli('eas-cli', input.easVersion, input.packager, input.easCache)); + await (0, core_1.group)(message, () => installCli('eas-cli', version, input.packager, input.easCache)); } if (!input.token) { (0, core_1.info)(`Skipped authentication: 'token' not provided.`); @@ -65246,16 +65246,15 @@ async function setupAction(input = setupInput()) { } } exports.setupAction = setupAction; -async function installCli(name, version, packager, cache = true) { - const cliVersion = await (0, packager_1.resolvePackage)(name, version); - let cliPath = (0, worker_1.findTool)(name, cliVersion) || undefined; - if (!cliPath && cache) { - cliPath = await (0, cacher_1.restoreFromCache)(name, cliVersion, packager); +async function installCli(name, version, packager, useCache = true) { + let cliPath = (0, worker_1.findTool)(name, version) || undefined; + if (!cliPath && useCache) { + cliPath = await (0, cacher_1.restoreFromCache)(name, version, packager); } if (!cliPath) { - cliPath = await (0, packager_1.installPackage)(name, cliVersion, packager); - if (cache) { - await (0, cacher_1.saveToCache)(name, cliVersion, packager); + cliPath = await (0, packager_1.installPackage)(name, version, packager); + if (useCache) { + await (0, cacher_1.saveToCache)(name, version, packager); } } (0, worker_1.installToolFromPackage)(cliPath); diff --git a/src/actions/setup.ts b/src/actions/setup.ts index 026f8dd1..df235435 100644 --- a/src/actions/setup.ts +++ b/src/actions/setup.ts @@ -41,7 +41,7 @@ export async function setupAction(input: SetupInput = setupInput()) { ? `Installing eas-cli (${version}) from cache or with ${input.packager}` : `Installing eas-cli (${version}) with ${input.packager}`; - await group(message, () => installCli('eas-cli', input.easVersion, input.packager, input.easCache)); + await group(message, () => installCli('eas-cli', version, input.packager, input.easCache)); } if (!input.token) { @@ -59,19 +59,18 @@ export async function setupAction(input: SetupInput = setupInput()) { } } -async function installCli(name: string, version: string, packager: string, cache: boolean = true) { - const cliVersion = await resolvePackage(name, version); - let cliPath = findTool(name, cliVersion) || undefined; +async function installCli(name: string, version: string, packager: string, useCache = true) { + let cliPath = findTool(name, version) || undefined; - if (!cliPath && cache) { - cliPath = await restoreFromCache(name, cliVersion, packager); + if (!cliPath && useCache) { + cliPath = await restoreFromCache(name, version, packager); } if (!cliPath) { - cliPath = await installPackage(name, cliVersion, packager); + cliPath = await installPackage(name, version, packager); - if (cache) { - await saveToCache(name, cliVersion, packager); + if (useCache) { + await saveToCache(name, version, packager); } }