-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-binaries
49 lines (41 loc) · 1.08 KB
/
build-binaries
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env node
const { execSync } = require("child_process");
const { version } = require("./package.json");
try {
execSync("rm -r binaries/");
} catch (err) {
// ignore
}
execSync("yarn pkg -t node12-linux-x64,node12-macos-x64,node12-win-x64 --out-path binaries/ package.json");
console.log("Build done");
const files = [
"foundry-keystore-cli-linux",
"foundry-keystore-cli-macos",
"foundry-keystore-cli-win.exe"
];
process.chdir("binaries");
for (const file of files) {
const distFile = getDistFile(file);
execSync(`mv ${file} ${distFile}`);
const dir = removeExe(file);
execSync(`mkdir -p ${dir}`);
execSync(`mv ${distFile} ${dir}/`);
execSync(`zip -r ${dir}-${version}.zip ${dir}`);
}
/**
* @param {string} fileName
*/
function removeExe(fileName) {
if (fileName.indexOf("exe") !== -1) {
return fileName.slice(0, fileName.length - 4);
} else {
return fileName;
}
}
function getDistFile(fileName) {
if (fileName.indexOf("exe") !== -1) {
return "cckey.exe";
} else {
return "cckey";
}
}