-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
75 lines (68 loc) · 1.95 KB
/
tsdown.config.ts
File metadata and controls
75 lines (68 loc) · 1.95 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { defineConfig } from "tsdown";
const isProd = process.env.NODE_ENV === "production";
const sourcemap = isProd ? ("hidden" as const) : true;
function readEnvValue(key: string): string {
return (process.env[key] ?? "").trim();
}
// Channel is read inline here (vs imported from src/shared/channel) because
// tsdown's config loader doesn't follow TS-extension resolution. Equivalence
// with src/shared/channel.normalizeChannel + scripts/electron-builder.shared.cjs
// is pinned by src/shared/channel.config-parity.test.ts.
const channel = process.env.LIGHTCODE_CHANNEL === "nightly" ? "nightly" : "stable";
const buildDefines = {
__BUILD_SENTRY_DSN__: JSON.stringify(readEnvValue("SENTRY_DSN")),
__BUILD_SENTRY_ENVIRONMENT__: JSON.stringify(readEnvValue("SENTRY_ENVIRONMENT")),
__LIGHTCODE_CHANNEL__: JSON.stringify(channel),
};
const deps = {
alwaysBundle: ["electron-updater", "simple-git", "zod"],
onlyBundle: false as const,
neverBundle: [
"electron",
"node-pty",
"better-sqlite3",
"@anthropic-ai/claude-agent-sdk",
"@opencode-ai/sdk",
],
};
const shared = {
outDir: "dist/main",
platform: "node" as const,
format: "cjs" as const,
target: "node24" as const,
sourcemap,
dts: false,
minify: isProd ? ({ compress: { dropConsole: true, dropDebugger: true } } as const) : false,
define: buildDefines,
deps,
};
export default defineConfig([
{
entry: { main: "src/main/main.ts" },
clean: true,
...shared,
},
{
entry: { preload: "src/main/preload.ts" },
clean: false,
...shared,
},
{
entry: { supervisor: "src/supervisor/index.ts" },
clean: false,
...shared,
},
{
entry: { claudeSdkProbeWorker: "src/supervisor/agents/claude/sdkProbeWorker.ts" },
clean: false,
outDir: "dist/main",
platform: "node" as const,
format: "esm" as const,
target: "node24" as const,
sourcemap,
dts: false,
minify: false,
define: buildDefines,
deps,
},
]);