Skip to content

Move every Cloudflare command to the cf CLI - #48

Open
utsengar wants to merge 7 commits into
mainfrom
migrate-wrangler-to-cf
Open

utsengar wants to merge 7 commits into
mainfrom
migrate-wrangler-to-cf

Conversation

@utsengar

@utsengar utsengar commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

What

Moves htmlbin from Wrangler to Cloudflare's cf CLI (open beta, cf@1.0.0-beta.12). Every npm script, CI step and doc command now runs through cf, and wrangler.toml is gone.

  • Config: cloudflare.config.ts (from cf migrate), plus wrangler.config.ts for the CompiledWasm bundler rule
  • CI: cf workers versions create for PR previews, cf deploy on merge, Node 22 (cf needs >= 22.18), pipefail so a failed upload fails the step
  • Scripts: dev/deploy → cf; db:* → cf d1 raw / cf d1 migrations; stats.mjs, the dashboard and setup.mjs → cf
  • tail script removed (no cf equivalent; cf observability telemetry query covers recent logs)
  • Bumps: wrangler 4.145 (cf needs >= 4.136; 4.136 pulls undici 7.29.0, which fails the npm audit gate), Sentry 10.76 (runtime, needed for the workers-types 5 peer range), workers-types 5.20260930.2

Why Wrangler is still in package.json

cf builds by delegating to Wrangler and runs cf dev through it; @cloudflare/vite-plugin depends on it too. It's a build dependency of cf, not a CLI we call. cf dev also always keeps local state in .wrangler/state, so local cf d1 commands point there.

Tested locally

  • Fresh local DB seeded with npm run db:apply:local (cf), npm run dev (cf), npm run test:e2e: 152/152 pass; /og.png renders (CompiledWasm)
  • npm run stats -- --local and the dashboard's /api/overview return the e2e data through cf d1 raw
  • cf deploy --dry-run and cf workers versions create --dry-run build with the same bindings
  • From the cf source: deploys keep existing secrets (keep_bindings includes secrets), and domains map to custom-domain routes as before

Not verified

  • CI: preview-URL parsing and whether CLOUDFLARE_API_TOKEN has the scopes cf needs. The last two runs never got a GitHub runner.
  • Remote cf d1 raw / migrations (db:*:remote, remote stats/dashboard): no production queries were run.
  • setup.mjs against a fresh account (it would create resources).
  • cf dev needs both cf auth login and npm exec -- wrangler login (the bundled Wrangler handles the remote AI binding).

🤖 Generated with Claude Code

utsengar and others added 6 commits October 5, 2026 12:09
cf migrate needs wrangler/experimental-config (>= 4.100.0).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- cloudflare.config.ts (from cf migrate) + wrangler.config.ts (bundler rules)
- dev/deploy npm scripts use cf; deploy workflow uses cf deploy and
  cf workers versions create (Node 22 for cf)
- bump wrangler 4.136, sentry 10.76, workers-types 5.20260929.1
  (older 5.x pinned: newest is blocked as recently published)

wrangler.toml stays for d1 execute / tail, which cf can't replace yet.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…isory

wrangler 4.136's miniflare pulled undici 7.29.0 (high severity), which
fails the npm audit gate via @sentry/cloudflare's wrangler peer.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- tee hid a failed cf upload (default Actions bash has no pipefail)
- cf dev defaults to ~/.config/cloudflare/state; point it at .wrangler/state
- refresh stale wrangler mentions in .dev.vars.example

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

🚀 Cloudflare preview

URL: https://2554500f-htmlbin.utkarsh2012.workers.dev

Built from commit cdf3407b6b06e86b8e4b623b87c773d0452c496d.

Note: bindings (D1, KV, AI) are shared with production.
Avoid destructive PR tests on real data.

- db:* scripts use cf d1 raw / cf d1 migrations (by database UUID)
- stats.mjs and the dashboard query through cf d1 raw
- setup.mjs provisions D1/KV and secrets with cf
- drop the tail script (no cf equivalent; use cf observability telemetry query)
- local cf d1 commands use .wrangler/state, the dir cf dev always writes
- docs: command map, the --sql= gotcha, why wrangler stays a dependency

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@utsengar utsengar changed the title Build, preview, and deploy through the cf CLI Move every Cloudflare command to the cf CLI Oct 5, 2026
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