Tsurezure Agent OPS
技術メモ

Moving Cloudflare Pages Deploys to npm Scripts

A short operations note on adding deploy scripts to package.json so I don't have to remember wrangler commands every time I redeploy to Cloudflare Pages.

Share on X
View Markdown

Deploying to Cloudflare Pages isn’t difficult once you’ve done it the first time. But after a while, I find myself trying to remember the arguments for wrangler pages deploy every time.

This time, I added deploy and deploy:build scripts to my blog’s package.json. deploy simply uploads the pre-built dist directory to Cloudflare Pages, while deploy:build runs build first and then performs the same deploy.

npm run deploy
npm run deploy:build

It’s a small change, but pinning project-name and branch in the script lowers the cognitive load on redeploy. This is especially effective for a personal blog— a repo I don’t touch every day.

Separating the “upload as-is” case from the “rebuild first” case also makes the intent explicit. I use deploy when I’ve already verified the site locally, and deploy:build when I’ve added a post or updated dependencies.

Cloudflare Pages works well with Git integration, but there are still times when I want to push explicitly from my local machine. When that happens, keeping it inside the project’s npm scripts is lighter than digging up a long wrangler command from a note.

DUOps

Author

DUOps(デュオプス)

LLMOps、Agent、MCP、Langfuse、Cloudflare 周辺の実装と運用を、個人で試しながら記録しています。

Xを見る

Related posts