-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.js
41 lines (35 loc) · 996 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
41
import { execSync } from "node:child_process";
import { join } from "node:path";
import { build } from "esbuild";
const BASE = process.cwd();
const ENTRY_POINT = join(BASE, "src/index.ts");
function _build(inPath, outPath, external) {
build({
bundle: true,
minify: true,
format: "esm",
platform: "node",
target: "esnext",
keepNames: true,
entryPoints: [
{
in: inPath,
out: outPath,
},
],
outdir: "dist",
external: external,
});
}
try {
const t = performance.now();
// execSync(`npx dts-bundle-generator -o ${join("dist", "index.d.ts")} ${ENTRY_POINT} --no-check`, {
// stdio: "inherit",
// });
await Promise.all([
_build("src/index.ts", "index", ["zod"]),
]);
console.log(`\n> Build finished ! (done in ${(performance.now() - t).toFixed(3)} ms)\n`);
} catch (e) {
console.log(`ERROR: ${e.message}`);
}