refactor(dev): decouple the serveCommand lifecycle from the dev server - #582
Merged
Conversation
createDevServer now builds the backend only and returns its shutdown; dev.ts orchestrates the two visible steps — start the backend, then run the configured site.serveCommand pointed at it via a ServeCommandRunner. The isServingFrontend flag dies: the CLI never knew a frontend existed, only that a serveCommand was configured. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.1.6-pr.582.27b0175Prefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.1.6-pr.582.27b0175"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.1.6-pr.582.27b0175"
}
}
Preview published to npm registry — try new features instantly! |
davidsu
added a commit
that referenced
this pull request
Jul 30, 2026
…44 build, deploy --build The full #580 feature set, rebuilt on top of the decoupled serveCommand runner (#582). dev --remote is now just: resolve the configured serveCommand (or fail), resolve the app's published URL (or fail), run the same runner local dev uses — no backend, no parallel implementation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
netanelgilad
approved these changes
Jul 30, 2026
davidsu
added a commit
that referenced
this pull request
Jul 30, 2026
…44 build, deploy --build The full #580 feature set, rebuilt on top of the decoupled serveCommand runner (#582). dev --remote is now just: resolve the configured serveCommand (or fail), resolve the app's published URL (or fail), run the same runner local dev uses — no backend, no parallel implementation. Co-Authored-By: Claude Fable 5 <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.
Note
Description
Moves ownership of the frontend
site.serveCommandprocess out of the dev server and into thebase44 devcommand.createDevServer()is now purely the backend: it no longer takes anappId, no longer spawns or supervises the frontend process, and instead exposes ashutdown()handle. The command layer decides whether a serve command is configured, starts it, and wires signal handling and teardown around it. Pure refactor — the observable behavior ofbase44 devis unchanged.Related Issue
None
Type of Change
Changes Made
packages/cli/src/cli/dev/serve-command-runner.tswithcreateServeCommandRunner(), which builds aServeRunnerconfigured with the project root as cwd, theVITE_BASE44_APP_ID/VITE_BASE44_APP_BASE_URLenv vars, and the orangefrontenddev logger.createDevServer()(dev-server/main.ts): dropped theappIdoption and allServeRunnerconstruction, startup, exit-handling and teardown; replaced theisServingFrontendresult field withshutdown: () => Promise<void>so callers can tear the backend down themselves.commands/dev.ts: extractedrequireLinkedProject(),createConfiguredServeRunner()andstartServeCommand()helpers out ofdevAction(); the command now readssite.serveCommand, starts the runner, registersSIGINT/SIGTERMhandlers, and exits the process after shutting the backend down if the frontend dies.isServingFrontendflag; the "Backend running on …" line is emitted by the command via abackenddev logger.Testing
Checklist
Additional Notes
Existing coverage in `packages/cli/tests/cli/dev.spec.ts` already exercises both paths this refactor touches — running the frontend `serveCommand` with injected Base44 env vars, and stopping it when the dev server stops — and no test changes were needed. The tests were not executed as part of generating this description.
One consequence worth noting: `readProjectConfig()` is now called a second time inside `createConfiguredServeRunner()` (the dev server's `loadResources` already reads it), so the project config is parsed twice on startup.
🤖 Generated by Claude | 2026-07-30 12:30 UTC | 27b0175