Skip to content

fix: analyse the project again after framework setup - #260

Open
MattieTK wants to merge 1 commit into
mainfrom
fix/refresh-autoconfig-details-after-setup
Open

MattieTK wants to merge 1 commit into
mainfrom
fix/refresh-autoconfig-details-after-setup

Conversation

@MattieTK

@MattieTK MattieTK commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

prepareProject returned the project details detected before framework setup, so the first cf dev or cf build after setup used the pre-setup dev command, environment, and --mode support. This change analyses the configured project again after setup, as the Wrangler-migration route already does.

  • After a non-dry-run setup, the returned details come from a fresh analyzeProject, falling back to the pre-setup details if detection fails.
  • Dry runs do not re-analyse, since nothing has been written.
  • cf build still prefers the setup's build command, so framework build overrides are unchanged.

With @cloudflare/autoconfig 0.7.7 this has no visible effect, because detection finds the same commands before and after setup. It is needed for cloudflare/workers-sdk#16200, which sets up Next.js 16 projects with vinext for the cf target: without it, the first cf dev after setup would run next dev rather than vite dev. Later runs already pick up vinext through lib/vinext.ts.

Validation: the updated autoconfig-migration.test.ts passes, and pnpm check passes. The full CLI suite has seven local failures that also fail on main in my environment (agent environment variables, a shell CLOUDFLARE_ACCOUNT_ID, and a WSL spawn error).

Merge order

This is one of three related changes:

  1. fix: analyse the project again after framework setup #260 (re-analyse the project after setup) can merge at any time. It has no visible effect with the current @cloudflare/autoconfig, but it must be in cf before step 4, otherwise the first cf dev after setup runs next dev rather than vite dev. (this PR)
  2. feat(init): add --name to set the Cloudflare Worker name vinext#3863 (add --name to vinext init) merges and is released.
  3. [autoconfig] Configure Next.js 16 projects with vinext for cf workers-sdk#16200 (use vinext for Next.js 16 on the cf target) is updated to pass the Worker name chosen during setup to vinext init --name and to require the vinext release from step 2. It then merges and @cloudflare/autoconfig is released.
  4. cf bumps @cloudflare/autoconfig to the release from step 3, after fix: analyse the project again after framework setup #260 has merged.

prepareProject returned the details detected before framework setup, so
cf dev and cf build used pre-setup commands, environment, and mode
support on their first run. Setup can change a project's tooling (for
example autoconfig setting up Next.js with vinext), so analyse the
configured project again, as the Wrangler-migration route already does.
@ask-bonk

ask-bonk Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@pkg-pr-new

pkg-pr-new Bot commented Oct 11, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/cf@260

commit: c65b7a9

@github-actions

Copy link
Copy Markdown
Contributor

cf --help startup

mean stddev min max
PR 257.8 ms 4.0 ms 251.7 ms 268.9 ms
base 258.5 ms 6.3 ms 251.9 ms 275.6 ms

Δ (PR vs base): — -0.6 ms (-0.2%)

Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.

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.

1 participant