-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ts
More file actions
30 lines (25 loc) · 657 Bytes
/
build.ts
File metadata and controls
30 lines (25 loc) · 657 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
import { $ } from 'bun'
import process from 'node:process'
import { dts } from 'bun-plugin-dtsx'
console.log('Building...')
const result = await Bun.build({
entrypoints: ['src/index.ts', 'bin/cli.ts'],
target: 'bun',
outdir: './dist',
sourcemap: 'inline',
external: ['confbox'],
plugins: [dts()],
})
if (!result.success) {
console.error('Build failed')
for (const message of result.logs) {
console.error(message)
}
process.exit(1)
}
await $`cp ./dist/src/index.js ./dist/index.js`
await $`rm -rf ./dist/src`
await $`cp ./dist/bin/cli.js ./dist/cli.js`
await $`rm -rf ./dist/bin`
console.log('Build successful!')
process.exit(0)