Cloudflare Pages CLI
Overview
Section titled “Overview”Use Direct Upload: build locally with bun, then push the prebuilt dist/ folder with the Wrangler CLI — no Git integration required.
security-docs/├── bun run build → dist/└── bunx wrangler pages deploy dist → https://<project>.pages.dev1. Authenticate (one-time)
Section titled “1. Authenticate (one-time)”bunx wrangler loginFor CI / non-interactive use, set these env vars instead:
export CLOUDFLARE_ACCOUNT_ID="<ACCOUNT_ID>"export CLOUDFLARE_API_TOKEN="<API_TOKEN>"2. Create the project (one-time)
Section titled “2. Create the project (one-time)”bunx wrangler pages project createPrompts for a project name (→ <NAME>.pages.dev) and production branch, then caches both.
3. Deploy (every time)
Section titled “3. Deploy (every time)”bun run buildbunx wrangler pages deploy distThe first pages deploy can also create the project and deploy in one step.
Preview deploys
Section titled “Preview deploys”bunx wrangler pages deploy dist --branch=staging# → https://staging.<project>.pages.devUseful commands
Section titled “Useful commands”| Task | Command |
|---|---|
| Log in | bunx wrangler login |
| Create project | bunx wrangler pages project create |
| Deploy production | bunx wrangler pages deploy dist |
| Deploy preview | bunx wrangler pages deploy dist --branch=staging |
| List projects | bunx wrangler pages project list |
| List deployments | bunx wrangler pages deployment list |
Limits
Section titled “Limits”| Item | Limit / note |
|---|---|
| Files per deploy | 20,000 |
| Max file size | 25 MiB |
| ZIP uploads | Not supported via Wrangler |
| Switching to Git integration | Not possible later — recreate the project |