File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ Desktop.ini
2020# Source code (kept private — published via npm only)
2121src /
2222tests /
23- scripts /
23+ scripts /*
24+ ! scripts /build.mjs
2425mcp-template /
2526autoparc /
2627assets /
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+ /**
3+ * build.mjs — esbuild production build.
4+ *
5+ * Bundles all entrypoints into minified ESM files.
6+ * No source maps, no .d.ts declarations — internal structure not exposed.
7+ */
8+ import * as esbuild from "esbuild" ;
9+ import { rmSync } from "node:fs" ;
10+ import { resolve , dirname } from "node:path" ;
11+ import { fileURLToPath } from "node:url" ;
12+
13+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
14+ const ROOT = resolve ( __dirname , ".." ) ;
15+
16+ try {
17+ rmSync ( resolve ( ROOT , "dist" ) , { recursive : true } ) ;
18+ } catch {
19+ // dist/ didn't exist yet
20+ }
21+
22+ await esbuild . build ( {
23+ // Top-level entrypoints (shebang added via banner)
24+ // install.ts and http-server.ts are dynamically imported by server.ts —
25+ // listing them here gives them a stable name in dist/ and ensures correct
26+ // chunk resolution at runtime.
27+ entryPoints : [
28+ "src/server.ts" ,
29+ "src/setup-auth.ts" ,
30+ "src/doctor.ts" ,
31+ "src/install.ts" ,
32+ "src/http-server.ts" ,
33+ ] ,
34+ outdir : "dist" ,
35+ bundle : true , // inline all static imports from our own code
36+ minify : true , // strip whitespace, mangle identifiers
37+ splitting : true , // code-split dynamic import() correctly (ESM only)
38+ platform : "node" ,
39+ target : "node20" ,
40+ format : "esm" ,
41+ packages : "external" , // leave node_modules as peer imports (not inlined)
42+ absWorkingDir : ROOT ,
43+ } ) ;
44+
45+ console . log ( "✅ Build complete — dist/ ready" ) ;
You can’t perform that action at this time.
0 commit comments