-
Notifications
You must be signed in to change notification settings - Fork 45
/
build.ts
37 lines (31 loc) · 695 Bytes
/
build.ts
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
import { $ } from 'bun'
import { build, type Options } from 'tsup'
await $`rm -rf dist`
const tsupConfig: Options = {
entry: ['src/**/*.ts'],
splitting: false,
sourcemap: false,
clean: true,
bundle: true
} satisfies Options
await Promise.all([
// ? tsup esm
build({
outDir: 'dist',
format: 'esm',
target: 'node20',
cjsInterop: false,
...tsupConfig
}),
// ? tsup cjs
build({
outDir: 'dist/cjs',
format: 'cjs',
target: 'node20',
// dts: true,
...tsupConfig
})
])
await $`tsc --project tsconfig.dts.json`
await Promise.all([$`cp dist/*.d.ts dist/cjs`])
process.exit()