kuhrcom / wrangler

🀠 wrangle your cloudflare workers
https://workers.cloudflare.com
Apache License 2.0
0 stars 0 forks source link

🀠 wrangler

:stop_sign: This repository is for Wrangler version 1, which is deprecated and no longer updated. This repository is now archived.

New versions of Wrangler are maintained in the Workers SDK repository.


Legacy Documentation ![Banner](/banner.png) [![crates.io](https://img.shields.io/crates/v/wrangler.svg)](https://crates.io/crates/wrangler)   [![npm](https://img.shields.io/npm/v/@cloudflare/wrangler.svg)](https://www.npmjs.com/package/@cloudflare/wrangler)   [![GitHub Actions - Test Status](https://github.com/cloudflare/wrangler-legacy/workflows/Tests/badge.svg)](https://github.com/cloudflare/wrangler-legacy/actions)   [![GitHub Actions - Linter Status](https://github.com/cloudflare/wrangler-legacy/workflows/Linters/badge.svg)](https://github.com/cloudflare/wrangler-legacy/actions)   `wrangler` is a CLI tool designed for folks who are interested in using [Cloudflare Workers](https://workers.cloudflare.com/). ![Wrangler Demo](/wrangler-demo.gif) ## Installation You have many options to install wrangler! For the latest version, see https://github.com/cloudflare/workers-sdk ### Install with `npm` We strongly recommend you install `npm` with a Node version manager like [`nvm`](https://github.com/nvm-sh/nvm#installing-and-updating), which puts the global `node_modules` in your home directory to eliminate permissions issues with `npm install -g`. Distribution-packaged `npm` installs often use `/usr/lib/node_modules` (which is root) for globally installed `npm` packages, and running `npm install -g` as `root` prevents `wrangler` from installing properly. Once you've installed `nvm` and configured your system to use the `nvm` managed node install, run: ```bash npm i @cloudflare/wrangler -g ``` If you are running an ARM based system (eg Raspberry Pi, Pinebook) you'll need to use the `cargo` installation method listed below to build wrangler from source. #### Specify binary location In case you need `wrangler`'s npm installer to place the binary in a non-default location (such as when using `wrangler` in CI), you can use the following configuration options to specify an install location: - Environment variable: `WRANGLER_INSTALL_PATH` - NPM configuration: `wrangler_install_path` #### Specify binary site URL In case you need to store/mirror binaries on premise you will need to specify where wrangler should search for them by providing any of the following: - Environment variable: `WRANGLER_BINARY_HOST` - NPM configuration: `wrangler_binary_host` ### Install with `cargo` ```bash cargo install wrangler ``` If you don't have `cargo` or `npm` installed, you will need to follow these [additional instructions](https://developers.cloudflare.com/workers/cli-wrangler/install-update/#manual-install). ### Install on Windows [perl is an external dependency of crate openssl-sys](https://github.com/sfackler/rust-openssl/blob/b027f1603189919d5f63c6aff483243aaa188568/openssl/src/lib.rs#L11-L15). If installing wrangler with cargo, you will need to have perl installed. We've tested with [Strawberry Perl](https://www.perl.org/get.html). If you instead install perl via scoop, you may need to also run `scoop install openssl` in order to get the necessary openssl dlls. Installing wrangler with `npm` instead of cargo is another option if you don't want to install perl. ## Updating For information regarding updating Wrangler, click [here](https://developers.cloudflare.com/workers/cli-wrangler/install-update#update). ## Getting Started Once you have installed Wrangler, spinning up and deploying your first Worker is easy! ```console $ 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. ```bash wrangler generate