fix(dev): forward documented flags to the background dev server process - #17541
fix(dev): forward documented flags to the background dev server process#17541kdelay wants to merge 1 commit into
Conversation
astro dev --background spawns a plain astro dev child process but only forwarded --port, --host, --config, --root, --allowed-hosts, and --json. The documented --mode, --site, --base, --outDir, --verbose, and --silent flags were silently dropped, so a background dev server could behave differently from a foreground one started with the same flags. Extract the argv construction into buildDevProcessArgs, forward the missing flags, and cover the mapping with unit tests.
🦋 Changeset detectedLatest commit: 25220f0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 399 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The red It fails inside No assertion failed, and the same job is green on the other matrix entries. This PR only touches Let me know if you would like me to push a no-op commit so the job gets another run. |
Changes
astro dev --backgroundspawns a plainastro devchild process, but only forwarded--port,--host,--config,--root,--allowed-hosts, and--json. The documented--mode,--site,--base,--outDir,--verbose, and--silentflags were silently dropped, so a background dev server could behave differently from a foreground one started with the same flags (e.g.astro dev --background --mode stagingstarts the server in the default mode).buildDevProcessArgs(flags)inpackages/astro/src/cli/dev/background.tsand forwards the missing flags.--open,--force, and--ignore-lockare intentionally not forwarded since they are handled at the parent level or don't apply to the child process.--hostnot taken into account with--background), for the remaining documented dev flags.astropatch).Reproduction (before, from
packages/astro/test/fixtures/astro-basic):After this change the child process argv is
dev --port 4877 --mode staging --json.Testing
test/units/dev/background-args.test.ts(12 unit tests) covering the child argv mapping: defaults, port/host variants (--hostwith and without a value), config/root, allowed-hosts, each newly forwarded flag, and that--backgrounditself is never passed to the child.--mode staging(checked viaps), and thatastro dev stopstill works.Docs
No docs changes needed: this makes
astro dev --backgroundhonor already-documentedastro devflags.