Cloudflare Pages Wrangler
Direct-upload Cloudflare Pages deployment and custom-domain binding for sites that do not use a Git repository. WHAT IT DOES
Create and deploy a Cloudflare Pages project from a local directory, then bind a custom domain, without requiring Git integration or a GitHub repository. It wraps the Wrangler direct-upload workflow behind normal typed swamp methods so deployments are repeatable, auditable, and secret safe. Prefer it over manual drag-and-drop uploads or a shell script: the account, token, project name, directory, and domain all come from model arguments, and every method writes swamp data.
INSTALL
swamp extension pull @svendowideit/cloudflare-pages-wranglerDEPENDENCIES
@swamp/cloudflare/pages supplies the Cloudflare Pages project type;
direct upload uses Wrangler through npx on the host. Cloudflare account ID
and a Pages-editing API token are required at run time.
RUN
# Create a direct-upload Pages project.
swamp model method run pages createProject \
--input name=figy-blog
# Deploy a rendered directory to that project.
swamp model method run pages deployDirect \
--input projectName=figy-blog --input directory=/home/me/site
# Bind the custom domain to the project.
swamp model method run pages bindDomain \
--input projectName=figy-blog --input domain=blog.example.comCONFIGURE
Set the global arguments on the model: accountId Cloudflare account ID apiToken Pages-capable Cloudflare API token productionBranch Production branch label (default main)
Method arguments: createProject.name Pages project name deployDirect.projectName Project to deploy deployDirect.directory Local directory to upload deployDirect.branch Optional deployment branch bindDomain.projectName Project receiving the domain bindDomain.domain Domain to bind
WHAT IT INSTALLS
Nothing persistent on the host. The model calls Cloudflare Pages APIs and
runs Wrangler as a subprocess. Upgrade is just swamp extension update
because nothing is installed locally.
Global Arguments
| Argument | Type | Description |
|---|---|---|
| accountId | string | Cloudflare account ID |
| apiToken | string | Cloudflare API token with Pages Edit and Zone DNS Edit |
| productionBranch? | string | Production branch name for the Pages project |
| Argument | Type | Description |
|---|---|---|
| name | string | Pages project name |
| productionBranch? | string | Production branch for the project |
| Argument | Type | Description |
|---|---|---|
| projectName | string | Pages project name |
| directory | string | Local directory to upload |
| branch? | string | Deployment branch |
| Argument | Type | Description |
|---|---|---|
| projectName | string | Pages project name |
| domain | string | Custom domain name |
Resources
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Docs keep secrets in a vault1/1earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License2/2earned
- Verified public repository2/2earned