-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.ts
39 lines (32 loc) · 840 Bytes
/
gulpfile.ts
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
import gulp from "gulp";
import { readFileSync } from "fs";
const { exec } = require("pkg") as {
exec: (args: string[]) => Promise<void>;
};
const pkg = exec;
const version = (() => {
const pkgjson = readFileSync("package.json", "utf-8");
const parsed = JSON.parse(pkgjson);
return parsed.version as string;
})();
const NODE_VERSION = "node12";
async function build(os: string) {
const ext = os.includes("win-") ? ".exe" : "";
await pkg([
"dist/bin.js",
"--target",
`${NODE_VERSION}-${os}`,
"--output",
`release/saros-${os}-${version}${ext}`,
]);
}
async function buildWindows() {
return build("win-x64");
}
async function buildMac() {
return build("mac-x64");
}
async function buildLinux() {
return build("linux-x64");
}
gulp.task("default", gulp.series(buildWindows, buildMac, buildLinux));