-
Notifications
You must be signed in to change notification settings - Fork 23
/
build.ts
34 lines (31 loc) · 772 Bytes
/
build.ts
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
import * as esbuild from "esbuild";
import * as fsExtra from "fs-extra";
const isDev = process.argv[2] === "dev";
const dir = "./scripts";
if (!fsExtra.pathExists(dir)) {
fsExtra.mkdirSync(dir);
}
fsExtra.emptyDirSync(dir);
esbuild
.build({
entryPoints: ["src/index.ts"],
bundle: true,
outfile: "scripts/index.js",
minify: !isDev,
platform: "neutral",
watch: isDev,
external: [
"@minecraft/server",
"@minecraft/server-ui",
"@minecraft/server-net",
"@minecraft/server-admin",
],
legalComments: isDev ? "none" : "none",
})
.then((_r) => {
console.log(
`\x1b[33m%s\x1b[0m`,
`[${new Date().toLocaleTimeString()}]`,
`Built for ${isDev ? "development" : "production"}...`
);
});