Skip to content

Commit

Permalink
chore: adjust build process
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Oct 8, 2024
1 parent d4745fc commit 1e5c63c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
1 change: 1 addition & 0 deletions .vscode/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ lockb
mkcert
openweb
outdir
outfile
pausable
pkgx
Postcardware
Expand Down
11 changes: 2 additions & 9 deletions scripts/build.ts → build.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
import path from 'node:path'
import { log } from '@stacksjs/logging'
import { $ } from 'bun'
import dts from 'bun-plugin-dts-auto'

log.info('Building...')

$.cwd(path.resolve(import.meta.dir, '..'))
await $`rm -rf ./dist`

await Bun.build({
entrypoints: ['./src/index.ts', './bin/cli.ts'],
outdir: './dist',
format: 'esm',
target: 'bun',
external: ['rollup', 'fsevents'],

plugins: [
dts({
cwd: path.resolve(import.meta.dir, '..'),
}),
dts(),
],
})

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`
await $`cp ./bin/cli.d.ts ./dist/cli.d.ts` // while bun-plugin-dts-auto doesn't support bin files well
await $`cp ./bin/cli.d.ts ./dist/cli.d.ts`
await $`rm ./bin/cli.d.ts`

log.success('Built')
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"files": ["dist", "scripts", "src"],
"scripts": {
"build": "bun scripts/build.ts && bun run compile",
"build": "bun build.ts",
"compile": "bun build ./bin/cli.ts --compile --external rollup --minify --sourcemap --outfile dist/reverse-proxy",
"postcompile": "bun ./scripts/post-compile.ts",
"lint": "bunx biome check .",
Expand Down

0 comments on commit 1e5c63c

Please sign in to comment.