forked from TONresistor/teleton-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsup.config.ts
More file actions
42 lines (38 loc) · 1.09 KB
/
tsup.config.ts
File metadata and controls
42 lines (38 loc) · 1.09 KB
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 { defineConfig } from "tsup";
import { rmSync, readdirSync } from "node:fs";
import { join } from "node:path";
import pkg from "./package.json" with { type: "json" };
// Bundle everything EXCEPT production dependencies and Node builtins.
// This ensures @ston-fi/* (devDeps with pnpm-only install blocker)
// and all their transitive deps are inlined into dist/.
const external = [
...Object.keys(pkg.dependencies ?? {}),
...Object.keys(pkg.optionalDependencies ?? {}),
];
// Clean dist/ but preserve dist/web/ (Vite frontend build)
function cleanDistPreserveWeb() {
try {
for (const entry of readdirSync("dist")) {
if (entry === "web") continue;
rmSync(join("dist", entry), { recursive: true, force: true });
}
} catch {
// dist/ doesn't exist yet — nothing to clean
}
}
cleanDistPreserveWeb();
export default defineConfig({
entry: {
index: "src/index.ts",
"cli/index": "src/cli/index.ts",
},
format: "esm",
target: "node20",
platform: "node",
splitting: true,
clean: false,
dts: false,
sourcemap: false,
outDir: "dist",
external,
});