-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild-production.js
36 lines (27 loc) · 982 Bytes
/
build-production.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
const zip = require("electron-installer-zip");
const rimraf = require("rimraf");
const path = require("path");
const fs = require("fs");
const { promisify } = require("util");
const { execSync } = require("child_process");
const { prodBuilds } = require("./package.json");
const zipAsync = promisify(zip);
(async () => {
console.log("\nPackaging all platforms... \n");
for(const build of prodBuilds) {
console.log(`Packaging ${build}`)
execSync(`npm run build:${build}`, { stdio: "ignore" });
}
console.log("\nCompressing... \n");
let packedBuilds = fs.readdirSync(path.join(__dirname, "build"));
for(const build of packedBuilds) {
console.log(`Compressing ${build}`);
const buildPath = path.join("build", build);
// problem code
await zipAsync({
dir: buildPath,
out: `${buildPath}.zip`
});
rimraf.sync(buildPath);
}
})();