-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.js
40 lines (34 loc) · 953 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
39
40
const esbuild = require("esbuild");
const fs = require("fs");
const path = require("path");
const process = require("process");
const outdir = "dist/";
const production = process.env["NODE_ENV"] === "production";
esbuild
.build({
entryPoints: ["modules/keikaku.ts"],
bundle: true,
format: "esm",
platform: "browser",
sourcemap: !production,
minify: production,
outbase: "./",
outdir: outdir,
})
.then(() => {
const staticAssets = [
"module.json",
"i18n/en.json",
"styles/keikaku.css",
"templates/todo-item-form.hbs",
"templates/todo-list-control.hbs",
"templates/todo-list-item.hbs",
"templates/todo-list.hbs",
];
staticAssets.map((source) => {
const destination = path.join(outdir, source);
const basedir = path.dirname(destination);
fs.mkdirSync(basedir, { recursive: true });
fs.copyFileSync(source, destination);
});
});