-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtsup.config.ts
More file actions
53 lines (51 loc) · 1.09 KB
/
tsup.config.ts
File metadata and controls
53 lines (51 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
43
44
45
46
47
48
49
50
51
52
53
import { readFileSync } from "fs";
import { defineConfig } from "tsup";
const pkg = JSON.parse(readFileSync("package.json", "utf8")) as {
version: string;
};
const buildVersion = process.env.GH_ATTACH_BUILD_VERSION ?? pkg.version;
export default defineConfig([
{
entry: {
index: "src/index.ts",
mcp: "src/mcp/index.ts",
},
format: ["esm"],
dts: true,
sourcemap: true,
clean: true,
target: "node20",
},
{
entry: {
cli: "src/cli/index.ts",
},
format: ["esm"],
dts: true,
sourcemap: true,
target: "node20",
banner: {
js: "#!/usr/bin/env node",
},
define: {
"process.env.__PKG_VERSION__": JSON.stringify(buildVersion),
},
},
// CJS bundle for pkg binary packaging (pkg doesn't support ESM)
{
entry: {
"cli-pkg": "src/cli/index.ts",
},
format: ["cjs"],
dts: false,
sourcemap: false,
target: "node18",
noExternal: [/.*/],
banner: {
js: "#!/usr/bin/env node",
},
define: {
"process.env.__PKG_VERSION__": JSON.stringify(buildVersion),
},
},
]);