-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdist.js
More file actions
26 lines (22 loc) · 668 Bytes
/
dist.js
File metadata and controls
26 lines (22 loc) · 668 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
const builder = require("electron-builder")
const Platform = builder.Platform;
const fs = require('fs');
let platforms = {
"macos": Platform.MAC,
"win32": Platform.WINDOWS,
"linux": Platform.LINUX
};
let prepackagedFolder = fs.readdirSync(`${__dirname}/dist`).filter(function (file) {
return file.startsWith("Chatron-");
})[0];
let [, platform,] = prepackagedFolder.split("-");
// Promise is returned
builder.build({
targets: platforms[platform || process.platform].createTarget(),
prepackaged: `${__dirname}/dist/${prepackagedFolder}`,
config: {}
}).then(() => {
// handle result
}).catch((error) => {
console.error(error);
});