-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
42 lines (36 loc) · 1.2 KB
/
Copy pathtsdown.config.ts
File metadata and controls
42 lines (36 loc) · 1.2 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
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'tsdown';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
attw: {
ignoreRules: ['cjs-resolves-to-esm'],
profile: 'esm-only',
},
entry: ['./src/{index,plugins,run}.ts'],
onSuccess: async () => {
// Copy client files to dist folder for runtime access
const pluginNames = ['client-httpx'];
for (const pluginName of pluginNames) {
const srcPath = path.resolve(__dirname, 'src', 'plugins', '@hey-api', pluginName, 'bundle');
const destPath = path.resolve(
__dirname,
'dist',
'clients',
pluginName.slice('client-'.length),
);
if (fs.existsSync(srcPath)) {
fs.mkdirSync(path.dirname(destPath), { recursive: true });
fs.cpSync(srcPath, destPath, { recursive: true });
// replace core imports in client bundle
// const clientFiles = fs.readdirSync(destPath);
// for (const file of clientFiles) {
// replaceCoreImports(path.resolve(destPath, file));
// }
}
}
},
publint: true,
sourcemap: true,
});