Skip to content

Commit e8cb8b9

Browse files
committed
feat: add post-build script to copy injected JavaScript files to distribution directory
1 parent abcd323 commit e8cb8b9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tsup.config.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
import { defineConfig } from "tsup";
2+
import { copyFileSync, mkdirSync } from "node:fs";
3+
import { dirname, join } from "node:path";
4+
import { fileURLToPath } from "node:url";
5+
6+
const __filename = fileURLToPath(import.meta.url);
7+
const __dirname = dirname(__filename);
28

39
export default defineConfig({
410
entry: {
@@ -15,4 +21,21 @@ export default defineConfig({
1521
noExternal: [],
1622
treeshake: true,
1723
bundle: true, // Enable bundling to resolve path aliases
24+
onSuccess: async () => {
25+
// Copy injected JavaScript files to dist
26+
const targetDir = join(__dirname, "dist", "cli", "injected");
27+
mkdirSync(targetDir, { recursive: true });
28+
29+
const files = [
30+
"event-capture-client.js",
31+
"recording-ui-client.js",
32+
];
33+
34+
for (const file of files) {
35+
const src = join(__dirname, "src", "recorder", "injected", file);
36+
const dest = join(targetDir, file);
37+
copyFileSync(src, dest);
38+
console.log(`✓ Copied ${file} to dist/cli/injected/`);
39+
}
40+
},
1841
});

0 commit comments

Comments
 (0)