bun install
# .env
CF_API_TOKEN=xxx
CF_ACCOUNT_ID=xxx
# Delete all deployments except for the live production deployment
# (INCLUDING aliased deployments, eg. my-branch.exampleproj.pages.dev)
# CF_DELETE_ALIASED_DEPLOYMENTS=true
bun run start my-example-project
This script uses the Cloudflare API to list all deployments for a given Pages project, then deletes all but the live production deployment.
It uses exponential-backoff to retry failed requests.