Expose build mode support from autoconfig - #15593
Draft
edmundhung wants to merge 1 commit into
Draft
Conversation
🦋 Changeset detectedLatest commit: fa1708b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Contributor
|
LGTM |
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
edmundhung
force-pushed
the
edmundhung/autoconfig-build-mode
branch
2 times, most recently
from
September 10, 2026 15:42
d41a7ce to
0d1cc4f
Compare
`cf` delegates build and development to framework commands when autoconfig detects them, but not every command can consume Cloudflare build modes. Return a structured executable and argument vector with each command's mode capability so callers can append `--mode` safely and use the same subprocess runner for framework and Cloudflare delegates. The existing string command fields remain unchanged for output consumers. ## framework-class.ts Resolve detected command strings into executable/argument vectors and reject shell control operators that cannot be represented by a direct spawn. ### [+L40] Produce spawn-ready commands Quoted values remain single arguments, while each framework must opt its build and development commands into mode forwarding independently. ### [+L177..L198] Limit invocations to one process Control operators are rejected instead of silently changing the semantics of a structured subprocess invocation. ## details/index.ts Return resolved build and development command metadata during project analysis so `cf dev` can make the same forwarding decision as `cf build`. ## run.ts Include both commands in the setup summary while preserving the existing build, deploy, and version command strings. ### [+L537] Keep tool and command support separate The summary resolves capabilities from the framework command itself instead of inferring them from `buildTool`. ## astro.ts Astro build and dev commands accept `--mode` and pass the selected Vite mode through their Cloudflare integration. ### [+L27] Opt in both Astro commands Build and development independently advertise support for the same mode flag. ## vite.ts Vite build and dev commands expose the same mode capability after autoconfig installs the Cloudflare Vite plugin. ## run.test.ts Cover quoted argument parsing, operator rejection, and the boundary where a Wrangler-backed Angular command remains mode-unaware. Issue: cloudflare/cf#180 Reviewable-Commit-Version: 1
edmundhung
force-pushed
the
edmundhung/autoconfig-build-mode
branch
from
September 10, 2026 15:53
0d1cc4f to
fa1708b
Compare
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.
Fixes cloudflare/cf#180.
Autoconfig resolves the framework commands used by
cf buildandcf dev, but callers could not tell which commands consume Cloudflare build modes or execute them without reparsing a display string. This adds spawn-ready, command-scoped metadata to autoconfig details and summaries:Frameworks opt each command into mode forwarding individually. Astro and Vite build and development commands report
supportsMode: true; unsupported commands default tofalse. This keeps Angularng buildunchanged and correctly marks it unsupported even when Wrangler is the configured Cloudflare build tool.Detected command strings are parsed once into an executable and argument vector. Quoted values remain single arguments, while shell control operators are rejected because they cannot be represented by a direct subprocess spawn.
buildTool?: "vite" | "wrangler"remains available to identify the Cloudflare-aware tool configured by autoconfig. It is deliberately separate from the capabilities of the framework command being executed. ExistingbuildCommand,deployCommand, andversionCommandstring fields are preserved for current output consumers.The corresponding
cfchange can append--modeto supported framework invocations and execute both framework and Cloudflare delegates through the shared structured subprocess runner, replacingexecaCommandwithout string concatenation.cfand does not add a direct user-facing API workflow.Verification:
pnpm test:ciinpackages/autoconfig(208 tests)pnpm check:typeinpackages/autoconfigpnpm buildinpackages/autoconfigoxlint --deny-warnings --type-awareon changed TypeScript filesoxfmt --checkon changed files