-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ts
42 lines (39 loc) · 831 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
35
36
37
38
39
40
41
42
import { type BuildOptions, build } from "esbuild";
// core's common options
const coreOptions: BuildOptions = {
entryPoints: ["./src/core/index.ts"],
bundle: true,
minify: true,
sourcemap: false,
platform: "node",
target: "esnext",
} as const;
// cli's common options
const cliOptions: BuildOptions = {
entryPoints: ["./src/cli/main.ts"],
bundle: true,
minify: true,
sourcemap: false,
platform: "node",
target: "esnext",
banner: {
js: "#!/usr/bin/env node",
},
} as const;
Promise.all([
build({
...coreOptions,
format: "esm",
outfile: "./dist/core/index.mjs",
}),
build({
...coreOptions,
format: "cjs",
outfile: "./dist/core/index.js",
}),
build({
...cliOptions,
format: "cjs",
outfile: "./dist/cli/index.js",
}),
]).catch(() => process.exit(1));