forked from Jelmerro/Vieb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
46 lines (43 loc) · 1.23 KB
/
build.js
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
"use strict"
const builder = require("electron-builder")
const rimraf = require("rimraf").sync
const archiver = require("archiver")
const {readFileSync, statSync, createWriteStream} = require("fs")
const {version} = JSON.parse(readFileSync("package.json").toString())
const builds = {}
const isDir = loc => {
try {
return statSync(loc).isDirectory()
} catch (e) {
return false
}
}
rimraf("dist/")
process.argv.slice(1).forEach(a => {
if (a === "--linux") {
builds.linux = []
}
if (a === "--win") {
builds.win = []
}
if (a === "--mac") {
builds.mac = []
}
})
builder.build(builds).then(e => {
rimraf("dist/Vieb-*-mac.zip")
for (const os of ["mac", "mac-arm64"]) {
if (isDir(`dist/${os}/Vieb.app/`)) {
const zip = createWriteStream(`dist/Vieb-${version}-${os}.zip`)
const archive = archiver("zip", {"zlib": {"level": 9}})
archive.pipe(zip)
archive.directory(`dist/${os}/Vieb.app/`, "Vieb.app")
archive.file("README.md", {"name": "README.md"})
archive.file("LICENSE", {"name": "LICENSE"})
archive.finalize()
}
}
console.info(e)
}).catch(e => {
console.error(e)
})