-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
39 lines (32 loc) · 987 Bytes
/
tsdown.config.ts
File metadata and controls
39 lines (32 loc) · 987 Bytes
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
import type { UserConfig, UserConfigFn } from 'tsdown/config'
import { existsSync, readdirSync, statSync } from 'node:fs'
import { join } from 'node:path'
import { defineConfig } from 'tsdown/config'
// Automatically find all services in openapi-specs
function findServiceEntries(): Record<string, string> {
const entries: Record<string, string> = {}
const specsDir = 'openapi-specs'
if (!existsSync(specsDir)) {
return entries
}
const serviceDirs = readdirSync(specsDir)
for (const serviceDir of serviceDirs) {
const fullPath = join(specsDir, serviceDir)
if (statSync(fullPath).isDirectory()) {
const indexPath = join(fullPath, 'index.ts')
if (existsSync(indexPath)) {
entries[serviceDir] = indexPath
}
}
}
return entries
}
const config: UserConfig | UserConfigFn = defineConfig({
entry: {
...findServiceEntries(),
'mcp-server': 'src/mcp-server.ts',
},
dts: true,
outDir: 'dist',
})
export default config