-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtsup.config.ts
More file actions
38 lines (35 loc) · 1.09 KB
/
tsup.config.ts
File metadata and controls
38 lines (35 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
import { defineConfig } from "tsup";
import { copyFileSync, mkdirSync, existsSync } from "fs";
import { resolve, dirname } from "path";
import { fileURLToPath } from "url";
const __dirname = dirname(fileURLToPath(import.meta.url));
export default defineConfig({
entry: {
index: "src/index.ts",
cli: "src/cli.ts",
sdk: "src/sdk/main.ts",
"plugin-types": "src/plugins/types.ts",
"plugin-sdk/index": "src/plugin-sdk/index.ts",
},
format: ["esm"],
dts: false,
clean: true,
sourcemap: true,
target: "node22",
splitting: false,
external: ["playwright", "puppeteer-core", "better-sqlite3"],
onSuccess: async () => {
// Copy JSON config files to dist
const files = ["prompts.json", "default-config.json"];
const srcDir = resolve(__dirname, "src");
const distDir = resolve(__dirname, "dist");
for (const file of files) {
const srcPath = resolve(srcDir, file);
const distPath = resolve(distDir, file);
if (existsSync(srcPath)) {
copyFileSync(srcPath, distPath);
console.log(`Copied ${file} to dist/`);
}
}
},
});