Repository navigation
Expand file tree
/
Copy pathtsup.config.ts
More file actions
86 lines (83 loc) · 2.81 KB
/
Copy pathtsup.config.ts
File metadata and controls
86 lines (83 loc) · 2.81 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
76
77
78
79
80
81
82
83
84
85
86
import { defineConfig } from "tsup";
import { readFileSync, rmSync } from "fs";
const pkg = JSON.parse(readFileSync("./package.json", "utf-8"));
rmSync("./dist", { recursive: true, force: true });
// Never a literal secret in source: only set in the CI publish workflow's
// environment. Local/dev builds omit it, which keeps telemetry dormant by
// default (see src/telemetry/call-home-client.ts).
const TELEMETRY_API_KEY = process.env.KEYLENS_TELEMETRY_IDENTITY_API_KEY ?? "";
// Same rule as the API key: no literal URL anywhere in source. These must
// come from the CI environment (or a local override for testing); an empty
// value here means a real build has no token URL/endpoint and telemetry
// stays inert (see src/telemetry/call-home-client.ts).
const TELEMETRY_TOKEN_URL = process.env.KEYLENS_TELEMETRY_TOKEN_URL ?? "";
const TELEMETRY_ENDPOINT = process.env.KEYLENS_TELEMETRY_ENDPOINT ?? "";
export default defineConfig([
{
entry: { index: "src/index.ts" },
format: ["esm"],
dts: true,
sourcemap: true,
clean: false,
splitting: false,
target: "node22",
outDir: "dist",
external: ["playwright"],
noExternal: ["@telerik/machine-id"],
define: {
__VERSION__: JSON.stringify(pkg.version),
__TELEMETRY_API_KEY__: JSON.stringify(TELEMETRY_API_KEY),
__TELEMETRY_TOKEN_URL__: JSON.stringify(TELEMETRY_TOKEN_URL),
__TELEMETRY_ENDPOINT__: JSON.stringify(TELEMETRY_ENDPOINT),
},
},
{
entry: { guidance: "src/guidance.ts" },
format: ["esm"],
dts: true,
sourcemap: true,
clean: false,
splitting: false,
target: "es2022",
platform: "neutral",
outDir: "dist",
},
{
entry: { "cli/index": "src/cli/index.ts" },
format: ["esm"],
dts: true,
sourcemap: true,
clean: false,
splitting: false,
target: "node22",
outDir: "dist",
banner: { js: "#!/usr/bin/env node\n" },
external: ["playwright"],
noExternal: ["@telerik/machine-id"],
define: {
__VERSION__: JSON.stringify(pkg.version),
__TELEMETRY_API_KEY__: JSON.stringify(TELEMETRY_API_KEY),
__TELEMETRY_TOKEN_URL__: JSON.stringify(TELEMETRY_TOKEN_URL),
__TELEMETRY_ENDPOINT__: JSON.stringify(TELEMETRY_ENDPOINT),
},
},
{
entry: { "mcp/server": "src/mcp/server.ts" },
format: ["esm"],
dts: true,
sourcemap: true,
clean: false,
splitting: false,
target: "node22",
outDir: "dist",
banner: { js: "#!/usr/bin/env node\n" },
external: ["playwright", "@modelcontextprotocol/sdk", "zod"],
noExternal: ["@telerik/machine-id"],
define: {
__VERSION__: JSON.stringify(pkg.version),
__TELEMETRY_API_KEY__: JSON.stringify(TELEMETRY_API_KEY),
__TELEMETRY_TOKEN_URL__: JSON.stringify(TELEMETRY_TOKEN_URL),
__TELEMETRY_ENDPOINT__: JSON.stringify(TELEMETRY_ENDPOINT),
},
},
]);