wrangler

? wrangle your cloudflare workers

Github星跟蹤圖

? wrangler

Banner

crates.io  
Build Status

wrangler is a CLI tool designed for folks who are interested in using Cloudflare Workers.

Wrangler Demo

Installation

You have many options to install wrangler!

Install with npm

npm i @cloudflare/wrangler -g

Install with cargo

cargo install wrangler

If you don't have cargo or npm installed, you will need to follow these additional instructions.

Updating

For information regarding updating Wrangler, click here.

Getting Started

Once you have installed Wrangler, spinning up and deploying your first Worker is easy!

$ wrangler generate my-worker
$ cd my-worker
# update your wrangler.toml with your Cloudflare Account ID
$ wrangler config
$ wrangler publish

?️ Top Level Commands

? generate

Scaffold a project, including boilerplate code for a Rust library and a Cloudflare Worker.

wrangler generate <name> <template> --type=["webpack", "javascript", "rust"]

All of the arguments and flags to this command are optional:

? init

Creates a skeleton wrangler.toml in an existing directory. This can be used as an alternative to generate if you prefer to clone a repository yourself.

wrangler init <name> --type=["webpack", "javascript", "rust"]

All of the arguments and flags to this command are optional:

  • name: defaults to the name of your working directory
  • type: defaults to "webpack".

?⚙️ build

Build your project. This command looks at your wrangler.toml file and runs the build steps associated
with the "type" declared there.

Additionally, you can configure different environments.

? config

Configure your global Cloudflare user. This is an interactive command that will prompt you for your API token:

wrangler config
Enter API token:
superlongapitoken

You can also provide your email and global API key (this is not recommended for security reasons):

wrangler config --api-key
Enter email:
testuser@example.com
Enter global API key:
superlongapikey

You can also use environment variables to configure these values.

☁️ ? publish

Publish your Worker to Cloudflare. Several keys in your wrangler.toml determine whether you are publishing to a workers.dev subdomain or your own registered domain, proxied through Cloudflare.

Additionally, you can configure different environments.

You can also use environment variables to handle authentication when you publish a Worker.

# e.g.
CF_API_TOKEN=superlongtoken wrangler publish
# where
# $CF_API_TOKEN -> your Cloudflare API token

CF_API_KEY=superlongapikey CF_EMAIL=testuser@example.com wrangler publish
# where
# $CF_API_KEY -> your Cloudflare API key
# $CF_EMAIL -> your Cloudflare account email

? kv

Interact with your Workers KV store. This is actually a whole suite of subcommands. Read more about in Wrangler KV Documentation.

Additional Documentation

All information regarding wrangler or Cloudflare Workers is located in the Cloudflare Workers Developer Docs. This includes:

  • Using wrangler commands
  • Wrangler configuration
  • General documentation surrounding Workers development
  • All wrangler features such as Workers Sites and KV

✨Workers Sites

To learn about deploying static assets using wrangler, see the Workers Sites Quickstart.

主要指標

概覽
名稱與所有者cloudflare/wrangler-legacy
主編程語言Rust
編程語言Rust (語言數: 2)
平台
許可證Apache License 2.0
所有者活动
創建於2019-03-11 16:45:52
推送於2023-08-03 18:15:03
最后一次提交2023-08-03 14:14:59
發布數84
最新版本名稱v1.21.0 (發布於 2023-02-21 15:10:10)
第一版名稱v0.1.0 (發布於 2019-04-04 14:43:10)
用户参与
星數3.2k
關注者數57
派生數336
提交數2.8k
已啟用問題?
問題數1026
打開的問題數0
拉請求數928
打開的拉請求數0
關閉的拉請求數314
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?