You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(cli): run e2e suites against the compiled Bun binary via Node shim (#5227)
## Summary
This PR changes the TypeScript CLI build process to compile the next and
legacy shells as standalone Bun single-file executables rather than
JavaScript bundles. The e2e test harness is updated to invoke these
compiled binaries through the Node shim (`dist/supabase.js`) using a new
`SUPABASE_CLI_BINARY_OVERRIDE` environment variable.
## Key Changes
- **Build output format**: Changed `build:next` and `build:legacy`
scripts to use `bun build --compile` instead of bundling to `.js` files
- `dist/main-next.js` → `dist/supabase-next` (compiled binary)
- `dist/main-legacy.js` → `dist/supabase-legacy` (compiled binary)
- Platform-specific: Windows binaries get `.exe` extension
- **Shim binary resolution**: Updated `apps/cli/src/shared/cli/bin.ts`
to check `SUPABASE_CLI_BINARY_OVERRIDE` environment variable before
falling back to optional-dependency lookup
- Allows tests and local development to point at specific compiled
binaries on disk
- **E2E test harness refactoring**
(`packages/cli-test-helpers/src/harness.ts`):
- Added validation that compiled binaries exist before running tests
- Changed TypeScript CLI invocation from `bun dist/main-*.js` to `node
dist/supabase.js` with `SUPABASE_CLI_BINARY_OVERRIDE`
- Returns structured `BuiltCommand` object with optional binary override
instead of raw command array
- **CLI test helpers** (`apps/cli/tests/helpers/cli.ts`):
- Updated `spawnSupabase()` to use the shim + binary override pattern
- Renamed `source-cli-launcher.mjs` → `cli-launcher.mjs` and updated to
invoke `node` instead of `bun`
- Improved graceful shutdown handling for compiled binaries
- **Documentation**: Updated README and workflow comments to reflect the
new build artifacts and override mechanism
## Implementation Details
- The compiled binaries are platform-specific Bun single-file
executables, providing better performance and distribution than
JavaScript bundles
- The `SUPABASE_CLI_BINARY_OVERRIDE` mechanism allows the standard Node
shim to be tested against the real compiled binaries without requiring
platform-specific npm packages to be installed
- Build artifacts validation ensures e2e tests fail fast with clear
error messages if the CLI hasn't been built
https://claude.ai/code/session_01WUkpPMhmEzjNimziqC97q6
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Julien Goux <hi@jgoux.dev>
Copy file name to clipboardExpand all lines: AGENTS.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,6 +111,10 @@ nx run-many -t build test
111
111
112
112
Use `nx show project <name> --json` to discover available targets before running them — do not guess target names.
113
113
114
+
## Pull Requests
115
+
116
+
PR titles must follow conventional-commits format because the `Lint Pull Request` workflow runs `amannn/action-semantic-pull-request` against the title. Use `<type>(<scope>): <subject>` (e.g. `fix(cli): …`, `test(cli): …`, `feat(api): …`). A bare descriptive title like "Build TypeScript CLI as compiled Bun binaries" will fail the lint. When a PR is created (including by the Claude Code UI or someone else), check the title against this rule and update it if needed.
117
+
114
118
## Refactoring Policy
115
119
116
120
None of this code is published as a stable internal platform API, so backward compatibility is not a constraint. Prefer the simplest correct design, including substantial refactors, API reshaping, and deleting obsolete code when it improves the codebase.
Copy file name to clipboardExpand all lines: apps/cli/README.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,8 +87,10 @@ pnpm build:shim
87
87
Output in `dist/`:
88
88
89
89
-`dist/supabase.js` — base shim that routes to the correct platform binary
90
-
-`dist/main-next.js` — next shell bundle
91
-
-`dist/main-legacy.js` — legacy shell bundle
90
+
-`dist/supabase-next` — next shell compiled binary (Bun single-file executable for the host platform)
91
+
-`dist/supabase-legacy` — legacy shell compiled binary (Bun single-file executable for the host platform)
92
+
93
+
The shim resolves `SUPABASE_CLI_BINARY_OVERRIDE` (an absolute binary path) before falling back to the `@supabase/cli-<platform>` optional-dependency lookup. The e2e test harness uses this override to invoke the real shim + compiled binary handoff against the per-shell builds in `dist/`.
0 commit comments