-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ts
More file actions
43 lines (35 loc) · 878 Bytes
/
install.ts
File metadata and controls
43 lines (35 loc) · 878 Bytes
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
import * as fs from "fs";
import * as path from "path";
const
downloadRelease = require("download-github-release"),
GITHUB_USER = "wixtoolset",
GITHUB_REPO = "wix3",
DEST_PATH = path.resolve(__dirname, "wix-bin");
if (!fs.existsSync(DEST_PATH)) {
fs.mkdirSync(DEST_PATH);
}
downloadRelease(
GITHUB_USER,
GITHUB_REPO,
DEST_PATH,
filterReleases,
filterAssets
);
function filterReleases(release: GithubRelease): boolean {
return !release.prerelease && !release.draft && /^wix(\d+)rtm$/.test(release.tag_name);
}
function filterAssets(asset: GithubAsset): boolean {
return /^wix(\d+)-binaries\.zip$/.test(asset.name);
}
interface GithubRelease {
url: string;
name: string;
tag_name: string;
draft: boolean;
prerelease: boolean;
}
interface GithubAsset {
id: number;
url: string;
name: string;
}