UNPKG

cf-worker-prune-routes

Version:

Prune unused cloudflare worker routes

26 lines (19 loc) 1.23 kB
## Cloudflare Worker Prune Routes When using routes in a cloudflare worker `wrangler.toml` file, changing a route does not delete the route from cloudflare, it only adds new routes. This can cause bugs if you aren't expecting it. This script reads your wrangler.toml config, queries cloudflare for your existing routes, and removes any routes that aren't currently configured for your worker. The intention is to run this after deploying route changes, to clean up any routes that may have been removed. By default, this script will just output the routes that would have been deleted. If you want to actually delete the routes you must pass the `--execute` option ```shell # in your cloudlfare worker repo npx cf-worker-prune-routes --env staging ``` ``` Options: --version Show version number [boolean] -c, --config path to your wrangler.toml config [default: "./wrangler.toml"] -e, --env The env for the worker routes you want to prune [required] -p, --execute Execute route pruning -v, --verbose Show extra logs [default: false] --help Show help [boolean] ```