Skip to content

Commit 6a9a64e

Browse files
committed
refactor: init DIST w/ prefix for FILENAME
Signed-off-by: Dwi Siswanto <git@dw1.io>
1 parent da3b74f commit 6a9a64e

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

dist/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const inputVersion = const_1.core.getInput('version', { required: false });
1616
let inputTag = const_1.core.getInput('tag', { required: true });
1717
function get_slim() {
1818
return __awaiter(this, void 0, void 0, function* () {
19-
let DIST = '';
19+
let DIST = 'dist_';
2020
let EXT = '';
2121
let FILENAME = '';
2222
let KERNEL = '';
@@ -60,33 +60,33 @@ function get_slim() {
6060
if (KERNEL === 'linux') {
6161
EXT = 'tar.gz';
6262
if (MACHINE === 'x64') {
63-
DIST = 'linux';
63+
DIST += 'linux';
6464
}
6565
else if (MACHINE === 'arm') {
66-
DIST = 'linux_arm';
66+
DIST += 'linux_arm';
6767
}
6868
else if (MACHINE === 'arm64') {
69-
DIST = 'linux_arm64';
69+
DIST += 'linux_arm64';
7070
}
7171
}
7272
else if (KERNEL === 'darwin') {
7373
EXT = 'zip';
7474
if (MACHINE === 'x64') {
75-
DIST = 'mac';
75+
DIST += 'mac';
7676
}
7777
else if (MACHINE === 'arm64') {
78-
DIST = 'mac_m1';
78+
DIST += 'mac_m1';
7979
}
8080
}
8181
else {
8282
throw new Error(`${KERNEL} is not a supported platform.`);
8383
}
8484
// Was a known distribution detected?
85-
if (!DIST) {
85+
if (DIST == 'dist_') {
8686
throw new Error(`${MACHINE} is not a supported architecture.`);
8787
}
8888
// Derive the filename
89-
FILENAME = `dist_${DIST}.${EXT}`;
89+
FILENAME = `${DIST}.${EXT}`;
9090
URL = `https://github.com/slimtoolkit/slim/releases/download/${VER}/${FILENAME}`;
9191
const_1.core.debug(`Checking cache for slim...`);
9292
let slimPath = const_1.tc.find('slim', VER, MACHINE);

src/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const inputVersion = core.getInput('version', {required: false});
1010
let inputTag = core.getInput('tag', {required: true});
1111

1212
async function get_slim() {
13-
let DIST = '';
13+
let DIST = 'dist_';
1414
let EXT = '';
1515
let FILENAME = '';
1616
let KERNEL = '';
@@ -56,30 +56,30 @@ async function get_slim() {
5656
if (KERNEL === 'linux') {
5757
EXT = 'tar.gz';
5858
if (MACHINE === 'x64') {
59-
DIST = 'linux';
59+
DIST += 'linux';
6060
} else if (MACHINE === 'arm') {
61-
DIST = 'linux_arm';
61+
DIST += 'linux_arm';
6262
} else if (MACHINE === 'arm64') {
63-
DIST = 'linux_arm64';
63+
DIST += 'linux_arm64';
6464
}
6565
} else if (KERNEL === 'darwin') {
6666
EXT = 'zip';
6767
if (MACHINE === 'x64') {
68-
DIST = 'mac';
68+
DIST += 'mac';
6969
} else if (MACHINE === 'arm64') {
70-
DIST = 'mac_m1';
70+
DIST += 'mac_m1';
7171
}
7272
} else {
7373
throw new Error(`${KERNEL} is not a supported platform.`);
7474
}
7575

7676
// Was a known distribution detected?
77-
if (!DIST) {
77+
if (DIST == 'dist_') {
7878
throw new Error(`${MACHINE} is not a supported architecture.`);
7979
}
8080

8181
// Derive the filename
82-
FILENAME = `dist_${DIST}.${EXT}`;
82+
FILENAME = `${DIST}.${EXT}`;
8383
URL = `https://github.com/slimtoolkit/slim/releases/download/${VER}/${FILENAME}`;
8484

8585
core.debug(`Checking cache for slim...`)

0 commit comments

Comments
 (0)