cf_wrangler_deploy
cf_wrangler_deploy deploys one cf_worker_config value with wrangler deploy. Deployment accepts exactly one configuration; call the function once for each Worker that should be deployed.
xx writes the configuration as strict JSON in a private temporary directory, passes that directory through --cwd and the file through --config, and removes the directory after Wrangler exits. args cannot set --cwd, --config, or -c because xx manages those flags. Relative values for Wrangler's known path flags are resolved from the project root before Wrangler changes directories.
Arguments
| Argument | Required | Description |
|---|---|---|
config | Yes | Worker configuration to deploy. |
args | No | Additional string arguments passed to wrangler deploy, such as ("--env", "production"). |
deps | No | Dependencies activated before running Wrangler. Use these to provide Wrangler, credentials, an account ID, and generated Worker files. |
Example
This example expects package.json to list "wrangler": "4.123.0" in devDependencies.
load("@cloudflare@1", "cf_worker_config", "cf_wrangler_deploy")
load("@[email protected]", "npm_install")
load("@os@1", "env_prepend", "env_set")
wrangler = npm_install() + env_prepend("PATH", "node_modules/.bin")
account = env_set("CLOUDFLARE_ACCOUNT_ID", "0123456789abcdef0123456789abcdef")
worker = cf_worker_config({
"name": "api",
"main": "dist/worker.js",
"compatibility_date": "2026-08-18",
}, dir="backend/cloudflare")
cf_wrangler_deploy(worker, deps=[wrangler, account])