refactor(build): consolidate to Bun-native build workflow#1644
Merged
tyler-dane merged 4 commits intomainfrom Apr 14, 2026
Merged
refactor(build): consolidate to Bun-native build workflow#1644tyler-dane merged 4 commits intomainfrom
tyler-dane merged 4 commits intomainfrom
Conversation
Replace the legacy webpack + tsc + shelljs build pipeline with Bun-native
equivalents throughout the monorepo.
- Add `packages/scripts/src/commands/build.backend.ts`: new backend build
script using `Bun.build({ target: "bun" })` — bundles app.ts to a single
`build/backend/app.js`, copies the env file, and installs only the two
native-module externals (saslprep, @ngrok/ngrok)
- Fix `packages/backend/src/app.ts`: replace `require.main === module` with
`import.meta.main` so the server starts correctly from the bundled ESM output
- Replace shelljs with `Bun.$` in build.util.ts; make file-check async via
`Bun.file().exists()`
- Remove the `build` CLI subcommand entirely — web uses `bun run build:web`,
backend uses `bun run build:backend`; strip the dead build.ts, build.util.ts,
webpack.config.mjs, and tsconfig.build.json
- Collapse cli.validator, cli.types, cli.utils, cli.constants to remove all
build-specific option parsing and package list constants
- Drop `shelljs`/`@types/shelljs` from scripts package.json and `concurrently`
from root package.json
- Update deploy.md and cli-and-maintenance-commands.md to reflect new commands
and output paths (build/backend instead of build/node)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bun loads .env from the working directory, not the script's location. The runtime tip and deploy docs now reflect the correct invocation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
packages/scripts/src/commands/build.backend.ts): usesBun.build({ target: "bun" })to bundle the Express app to a singlebuild/backend/app.js; copies the env file for the selected environment; installs only the two native-module externals (saslprep,@ngrok/ngrok) via a minimalpackage.jsonapp.tsentry-point guard:require.main === module→import.meta.mainso the server starts correctly from the bundled ESM outputBun.$inbuild.util.ts; async file existence checks viaBun.file().exists()buildCLI subcommand entirely — web usesbun run build:web, backend usesbun run build:backend; deletedbuild.ts,build.util.ts,webpack.config.mjs,tsconfig.build.jsoncli.validator,cli.types,cli.utils,cli.constantsshelljs/@types/shelljsfrom scripts package,concurrentlyfrom rootdeploy.mdandcli-and-maintenance-commands.mdupdated with correct commands and output paths (build/backendinstead ofbuild/node)Test plan
bun run test:scripts— 9 suites, 57 tests, all passbun run build:backend --environment local— verifybuild/backend/app.jsis produced andbun build/backend/app.jsstarts the serverbun run build:web— verifybuild/web/assets are producedbun run dev:backend— verify dev server still starts🤖 Generated with Claude Code