forked from jasonwilliams/anki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
38 lines (37 loc) · 951 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
31
32
33
34
35
36
37
38
const production = process.argv[2] === "--production";
const watch = process.argv[2] === "--watch";
const { copy } = require("esbuild-plugin-copy");
const { sassPlugin } = require("esbuild-sass-plugin");
require("esbuild")
.build({
entryPoints: ["./src/extension.ts"],
bundle: true,
outdir: "out",
external: ["vscode"],
format: "cjs",
sourcemap: !production,
minify: production,
platform: "node",
plugins: [
copy({
resolveFrom: "cwd",
assets: {
from: ["./src/resources/icons/**/*.svg"],
to: ["./out/resources/icons/"],
},
keepStructure: true,
verbose: false,
}),
sassPlugin(),
],
watch: watch && {
onRebuild(error) {
if (error) console.error("watch build failed:", error);
else console.log("watch build succeeded");
},
},
})
.catch((e) => {
console.error(e);
process.exit(1);
});