-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.js
30 lines (25 loc) · 818 Bytes
/
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
const fs = require("fs");
const del = require("del");
const archiver = require("archiver");
const package_json = require("./package.json");
// create output stream
const output = fs.createWriteStream(__dirname + "/releases/extension_v" + package_json.version + ".zip");
// create new zip file
const archive = archiver("zip");
output.on("close", () => {
console.log(archive.pointer() + " total bytes");
});
archive.on("error", err => {
throw err;
});
// pipe all output into the writestream
archive.pipe(output);
// remove files we don't need/want
del(["extension/build/**/*.map", "extension/build/fonts/**"]).then(paths => {
// add files from extension folder to the zip
archive.glob("**/*", {
cwd: "extension"
});
// finalize the zip file and write it
archive.finalize();
});