From b7a7674ff90c1ea9461695baafdb5fab7a624696 Mon Sep 17 00:00:00 2001 From: Dwi Siswanto Date: Sun, 12 Jan 2025 09:49:28 +0700 Subject: [PATCH] refactor: init `DIST` w/ prefix for `FILENAME` Signed-off-by: Dwi Siswanto --- dist/index.js | 16 ++++++++-------- src/index.ts | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dist/index.js b/dist/index.js index 07246a4..a383bdb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16,7 +16,7 @@ const inputVersion = const_1.core.getInput('version', { required: false }); let inputTag = const_1.core.getInput('tag', { required: true }); function get_slim() { return __awaiter(this, void 0, void 0, function* () { - let DIST = ''; + let DIST = 'dist_'; let EXT = ''; let FILENAME = ''; let KERNEL = ''; @@ -60,33 +60,33 @@ function get_slim() { if (KERNEL === 'linux') { EXT = 'tar.gz'; if (MACHINE === 'x64') { - DIST = 'linux'; + DIST += 'linux'; } else if (MACHINE === 'arm') { - DIST = 'linux_arm'; + DIST += 'linux_arm'; } else if (MACHINE === 'arm64') { - DIST = 'linux_arm64'; + DIST += 'linux_arm64'; } } else if (KERNEL === 'darwin') { EXT = 'zip'; if (MACHINE === 'x64') { - DIST = 'mac'; + DIST += 'mac'; } else if (MACHINE === 'arm64') { - DIST = 'mac_m1'; + DIST += 'mac_m1'; } } else { throw new Error(`${KERNEL} is not a supported platform.`); } // Was a known distribution detected? - if (!DIST) { + if (DIST !== 'dist_') { throw new Error(`${MACHINE} is not a supported architecture.`); } // Derive the filename - FILENAME = `dist_${DIST}.${EXT}`; + FILENAME = `${DIST}.${EXT}`; URL = `https://github.com/slimtoolkit/slim/releases/download/${VER}/${FILENAME}`; const_1.core.debug(`Checking cache for slim...`); let slimPath = const_1.tc.find('slim', VER, MACHINE); diff --git a/src/index.ts b/src/index.ts index 8718b36..02a49b3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,7 +10,7 @@ const inputVersion = core.getInput('version', {required: false}); let inputTag = core.getInput('tag', {required: true}); async function get_slim() { - let DIST = ''; + let DIST = 'dist_'; let EXT = ''; let FILENAME = ''; let KERNEL = ''; @@ -56,30 +56,30 @@ async function get_slim() { if (KERNEL === 'linux') { EXT = 'tar.gz'; if (MACHINE === 'x64') { - DIST = 'linux'; + DIST += 'linux'; } else if (MACHINE === 'arm') { - DIST = 'linux_arm'; + DIST += 'linux_arm'; } else if (MACHINE === 'arm64') { - DIST = 'linux_arm64'; + DIST += 'linux_arm64'; } } else if (KERNEL === 'darwin') { EXT = 'zip'; if (MACHINE === 'x64') { - DIST = 'mac'; + DIST += 'mac'; } else if (MACHINE === 'arm64') { - DIST = 'mac_m1'; + DIST += 'mac_m1'; } } else { throw new Error(`${KERNEL} is not a supported platform.`); } // Was a known distribution detected? - if (!DIST) { + if (DIST !== 'dist_') { throw new Error(`${MACHINE} is not a supported architecture.`); } // Derive the filename - FILENAME = `dist_${DIST}.${EXT}`; + FILENAME = `${DIST}.${EXT}`; URL = `https://github.com/slimtoolkit/slim/releases/download/${VER}/${FILENAME}`; core.debug(`Checking cache for slim...`)