diff --git a/README.md b/README.md index a20f012..d848e60 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ -# Reverse Proxy +# A Better Developer Experience -A modern reverse proxy. Pretty dev URLs for your local projects, with simplicity and flexibility. +> A reverse proxy for local development with SSL support, custom domains, and more. ## ☘️ Features @@ -34,7 +34,7 @@ import { startProxy } from 'bun-reverse-proxy' startProxy({ from: 'localhost:3000', - to: 'my-project.localhost' + to: 'my-project.localhost' // or try 'my-project.test' }) ``` diff --git a/build.ts b/build.ts index acd5645..8a0a26d 100644 --- a/build.ts +++ b/build.ts @@ -1,11 +1,22 @@ -await Bun.build({ - entrypoints: [ - 'src/index.ts', - ], +import { $ } from 'bun' +import dts from 'bun-plugin-dts-auto' +await Bun.build({ + entrypoints: ['./src/index.ts', './bin/cli.ts'], outdir: './dist', + format: 'esm', + target: 'bun', - // plugins: [ - // dts(), - // ], + plugins: [ + dts({ + cwd: import.meta.dir, + }), + ], }) + +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 $`rm ./bin/cli.d.ts` diff --git a/compile.ts b/compile.ts new file mode 100644 index 0000000..c5c2a80 --- /dev/null +++ b/compile.ts @@ -0,0 +1,9 @@ +import { log, runCommand } from '@stacksjs/cli' + +// compiles the buddy binary +const result = await runCommand('bun build ./bin/cli.ts --compile --minify --sourcemap --outfile dist/reverse-proxy', { + cwd: import.meta.dir, +}) + +if (result.isErr()) + log.error(result.error) diff --git a/reverse-proxy.config.ts b/reverse-proxy.config.ts new file mode 100644 index 0000000..e553d20 --- /dev/null +++ b/reverse-proxy.config.ts @@ -0,0 +1,3 @@ +export default { + 'localhost:3000': 'stacks.localhost' +}