-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsup.config.ts
More file actions
57 lines (43 loc) · 1.09 KB
/
tsup.config.ts
File metadata and controls
57 lines (43 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
54
55
56
57
import { defineConfig } from "tsup";
export default defineConfig({
// Entry points - CLI and library entry
entry: {
cli: "src/cli.ts",
index: "src/index.ts",
},
// Output formats - ESM only (aligned with package.json type: "module")
format: ["esm"],
// TypeScript declarations
dts: true,
// Source maps for debugging
sourcemap: true,
// Clean dist directory before build
clean: true,
// Split chunks for better code splitting
splitting: true,
// Minify for production
minify: false, // Keep readable for now, enable in production
// Shims for Node.js globals
shims: true,
// Target environment
target: "node18",
// External dependencies (don't bundle)
external: ["commander", "globby", "ky", "micromatch", "tar"],
// Tree shaking
treeshake: true,
// Platform
platform: "node",
// Keep ESM compatibility
esbuildOptions(options) {
options.platform = "node";
},
// Add shebang for CLI entry
banner: ({ format }) => {
if (format === "esm") {
return {
js: "#!/usr/bin/env node",
};
}
return {};
},
});