Skip to content

refactor(config): migrate runtime and build flows to bun#1602

Merged
tyler-dane merged 1 commit intomainfrom
feat/bun-2
Apr 4, 2026
Merged

refactor(config): migrate runtime and build flows to bun#1602
tyler-dane merged 1 commit intomainfrom
feat/bun-2

Conversation

@tyler-dane
Copy link
Copy Markdown
Contributor

@tyler-dane tyler-dane commented Apr 3, 2026

Summary

  • switch root cli, backend dev, web dev, and e2e commands to Bun-managed entrypoints
  • replace Node-era backend startup glue with Bun-compatible runtime setup while keeping built Node output working
  • move node package build/install flow to Bun and add a Bun-based test dispatcher with Bun-native core tests
  • keep Jest intentionally for web, backend, and scripts tests, and update Jest config to ignore generated build output
  • refresh CI and repo docs to reflect the Bun-first workflow and current hybrid test strategy

Testing

  • bun run cli --help
  • bun run test:core
  • bun run test:web
  • ./node_modules/.bin/eslint packages/backend/src/app.ts packages/backend/src/init.ts packages/scripts/src/commands/build.ts packages/scripts/src/commands/build.util.ts packages/scripts/src/testing/run.ts packages/scripts/src/testing/core.preload.ts packages/scripts/src/testing/core.jest-compat.ts
  • bunx tsc --noEmit --pretty false (fails due to pre-existing repo type errors)
  • bun run test:backend (not verified in sandbox; mongodb-memory-server port binding is restricted)
  • bun run test:scripts (not verified in sandbox; mongodb-memory-server port binding is restricted)

Note

Medium Risk
Moderate risk because it rewires core developer workflows (CLI, dev servers, tests, and build packaging) and changes the build-time module-alias behavior, which could cause CI/dev regressions if any edge cases differ under Bun.

Overview
Moves the repo to a Bun-first workflow by switching root scripts for cli, dev:web, dev:backend, test:*, type-check, and test:e2e to Bun-managed entrypoints and removing cross-env, ts-node, and ts-node-dev usage.

Introduces a Bun-based test dispatcher (packages/scripts/src/testing/run.ts) with a hybrid strategy: core runs via bun test with a small Jest-compat preload, while web/backend/scripts continue running in the existing Jest harness; CI is updated to call bun run test:<project>.

Updates build packaging to run compilation and webpack via Bun.spawnSync, installs production deps in build/node via bun install --production, and adjusts backend startup/shutdown for Bun watch mode while keeping Node build output working via conditional module-alias setup. Documentation is refreshed to reflect the new commands and test strategy, and Jest config is tightened to only search under packages.

Reviewed by Cursor Bugbot for commit a2ed39b. Bugbot is set up for automated code reviews on this repo. Configure here.

@tyler-dane tyler-dane marked this pull request as ready for review April 4, 2026 00:27
@tyler-dane tyler-dane linked an issue Apr 4, 2026 that may be closed by this pull request
@tyler-dane tyler-dane merged commit 97a5ba2 into main Apr 4, 2026
9 checks passed
@tyler-dane tyler-dane deleted the feat/bun-2 branch April 4, 2026 00:27
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit a2ed39b. Configure here.

}): { exitCode: number };
};

const bunRuntime = (globalThis as unknown as { Bun: BunRuntime }).Bun;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BunRuntime type duplicated across three new files

Low Severity

The BunRuntime type and the bunRuntime constant extraction from globalThis are copy-pasted across three new files (build.ts, build.util.ts, run.ts). The definitions are slightly inconsistent—build.util.ts omits the env property while the others include it. A single shared type and accessor would reduce maintenance burden and prevent drift.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a2ed39b. Configure here.

}

process.env["BUN_CONFIG_NO_CLEAR_TERMINAL_ON_RELOAD"] = "true";
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertBackendEnvFile silently ignores missing file

Low Severity

assertBackendEnvFile doesn't assert anything—it silently returns when the env file is missing, and when the file exists it only sets the unrelated BUN_CONFIG_NO_CLEAR_TERMINAL_ON_RELOAD env var. The function name strongly implies it validates the file's existence, but no warning, error, or env-loading takes place when the file is absent.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a2ed39b. Configure here.


if (requestedProject) {
runProject(requestedProject);
return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No validation of requested project name argument

Low Severity

process.argv[2] is as-cast to keyof typeof TEST_PROJECTS without validating it's actually a known key. If an invalid project name is passed, TEST_PROJECTS[projectName] yields undefined, and the subsequent .cmd access in runProject throws an unhelpful TypeError instead of a descriptive error message.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a2ed39b. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert yarn to bun

1 participant