workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🚀 Feature Request: Build & Deploy Cloudflare Snippets

Open nathanclevenger opened this issue 4 months ago • 0 comments

Describe the solution

It would be great if there is a way to use wrangler to build & deploy a code file to Cloudflare Snippets so that snippets can be kept in source control.

Today, to keep snippets code in source control you have to do something like npx wrangler deploy snippet.ts --dry-run --outdir dist and then something along the lines of:

curl --request PUT https://api.cloudflare.com/client/v4/zones/{zone_id}/snippets/{snippet_name} \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: multipart/form-data" \
--form [email protected] \
--form metadata='{"main_module":"worker.js"}'

or copy/paste the worker.js into a snippet via the dashboard

It would be great if there was a simpler integration via wrangler. Is support for snippets at all planned?

nathanclevenger avatar Oct 22 '24 02:10 nathanclevenger