牧马人::cowboy_hat_face:打扰你的cloudflare工人

  • v1_517309
    了解作者
  • 972.1KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-15 00:31
    上传日期
:cowboy_hat_face: 牧马人 wrangler是一个CLI工具,专为对使用感兴趣的人们而设计。 安装 您有很多选择来安装牧马人! 用npm安装 我们强烈建议您使用类的Node版本管理器安装npm ,这将允许wrangler在用户主目录下的全局node_modules目录中安装配置数据,而无需以root身份运行。 安装nvm ,运行: npm i @cloudflare/wrangler -g 如果您正在运行基于ARM的系统(例如Raspberry Pi,Pinebook),则需要使用下面列出的cargo安装方法从源代码构建牧马人。 指定二进制站点URL 如果您需要在内部存储/镜像二进制文件,则需要通过提供以下任何一项来指定牧马人在哪里搜索二进制文件: 环境变量: WRANGLER_BINARY_HOST NPM配置: wrangler_binary_host 随cargo安装 cargo install wrangler 如果您没有安装cargo或npm ,则需要遵循以下。 在Windows上安装 。 如果要随货一起安装,则需要安装。 如果您不想安装per
wrangler-master.zip
内容介绍
# 🤠 wrangler ![Banner](/banner.png) [![crates.io](https://meritbadge.herokuapp.com/wrangler)](https://crates.io/crates/wrangler) &nbsp; [![npm](https://img.shields.io/npm/v/@cloudflare/wrangler.svg)](https://www.npmjs.com/package/@cloudflare/wrangler) &nbsp; [![GitHub Actions - Test Status](https://github.com/cloudflare/wrangler/workflows/Tests/badge.svg)](https://github.com/cloudflare/wrangler/actions) &nbsp; [![GitHub Actions - Linter Status](https://github.com/cloudflare/wrangler/workflows/Linters/badge.svg)](https://github.com/cloudflare/wrangler/actions) &nbsp; `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! ### 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 will allow `wrangler` to install configuration data in a global `node_modules` directory in your user's home directory, without requiring that you run as `root`. Once you've installed `nvm`, 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 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/tooling/wrangler/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 with cargo, you will need to have it installed. Installing with `npm` 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 <name> <template> --type=["webpack", "javascript", "rust"] ``` All of the arguments and flags to this command are optional: - `name`: defaults to `worker` - `template`: defaults to the [`https://github.com/cloudflare/worker-template`](https://github.com/cloudflare/worker-template) - `type`: defaults to ["webpack"](https://developers.cloudflare.com/workers/tooling/wrangler/webpack) ### 📥 `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. ```bash 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"](https://developers.cloudflare.com/workers/tooling/wrangler/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](https://developers.cloudflare.com/workers/tooling/wrangler/configuration/environments). ### 🔓 `login` Authenticate Wrangler with your Cloudflare login. This will prompt you with a Cloudflare account login page and is the alternative to `wrangler config`. ### 🔧 `config` Authenticate Wrangler with a Cloudflare API Token. This is an interactive command that will prompt you for your API token: ```bash wrangler config Enter API token: superlongapitoken ``` You can also provide your email and global API key (this is not recommended for security reasons): ```bash wrangler config --api-key Enter email: testuser@example.com Enter global API key: superlongapikey ``` You can also [use environment variables](https://developers.cloudflare.com/workers/tooling/wrangler/configuration/) 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](https://developers.cloudflare.com/workers/tooling/wrangler/configuration/environments). You can also use environment variables to handle authentication when you publish a Worker. ```bash # 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](https://developers.cloudflare.com/workers/tooling/wrangler/kv_commands). ### 👂 `dev` `wrangler dev` works very similarly to `wrangler preview` except that instead of opening your browser to preview your worker, it will start a server on localhost that will execute your worker on incoming HTTP requests. From there you can use cURL, Postman, your browser, or any other HTTP client to test the behavior of your worker before publishing it. You should run wrangler dev from your worker directory, and if your worker makes any requests to a backend, you should specify the host with `--host example.com`. From here you should be able to send HTTP requests to `localhost:8787` along with any headers and paths, and your worker should execute as expected. Additionally, you should see console.log messages and exceptions appearing in your terminal. ```bash 👂 Listening on http://localhost:8787 [2020-02-18 19:37:08] GET example.com/ HTTP/1.1 200 OK ``` All of the arguments and flags to this command are optional: - `env`: environment to build - `host`: domain to test behind your worker. defaults to example.com - `ip`: ip to listen on. defaults to localhost - `port`: port to listen on. defaults to 8787 ## Additional Documentation All information regarding wrangler or Cloudflare Workers is located in the [Cloudflare Workers Developer Docs](https://developers.cloudflare.com/workers/). This includes: - Using wrangler [commands](https://developers.cloudflare.com/workers/tooling/wrangler/commands) - Wrangler [configuration](https://developers.cloudflare.com/workers/tooling/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](https://developers.cloudflare.com/workers/sites/).
评论
    相关推荐
    • npm-repository:npm存储库代理
      npm-repository npm repository proxy 用于npm本地代理或者内网仓库,仅支持npm install命令。 环境: jdk 8 maven 3 配置文件: application.properties #代理服务器主机 server.hostname=localhost #端口 server....
    • piscis-npm-dummy-pkg:NPM虚拟软件包以测试专用NPM存储
      小型虚拟程序包,用于测试私有NPM存储库。 先决条件 像一样工作的私人NPM镜子 具有有效凭据的有效远程配置,请参阅 有关如何详细信息 准备包裹 请publishConfig package.json publishConfig设置以反映您的配置。
    • npm-adapter:将文件转到NPM存储
      < artifactId>npm-adapter [...] 怎么运行的? 首先,您上传由npm publish生成的json文件。然后,调用Npm#publish ,它触发meta.json文件的更新/生成和.tgz源代码档案的创建。 这提供了您需要对npm intall 命令...
    • Npm:@ T3am-Guia de uso Npm
      GUIAS DE USO EN NPM 全球的 手风琴 Npm的实现 npm install -g [paquete] @ [version] Npm全球配置 ...npm install [url]安装存储npm install [paquete] @ [version] Instala paquete con su pro
    • micro-npm-template:微型npm模板存储
      微型npm模板 npm功能 安装 使用安装: $ npm install --save npm-name 用法 const func = require ( 'npm-name' ) ;
    • npm-updates:从npm存储库发出更新事件
      npm存储库或任何节点模块存储库发出更新事件。 用法 const NPM = require ( 'npm-updates' ) ; const npm = new NPM ( ) ; npm . on ( 'update' , ( info ) => { console . log ( 'package' , info . name , 'was...
    • number-formatter:这是npm组件存储
      'npm install number-formatter-msenyoo' 用法 var numFormatter = require('number-formatter-msenyoo'); var formattedNum = numFormatter(123456789); 输出应为'123,456,789' 测验 'npm test'
    • lbaction-npmNPM(LauchBar 6操作)
      克隆/下载该存储库的母版,然后双击NPM.lbaction 。 然后,LaunchBar将提示您是否要安装它。 用法 输入npm ,然后应显示NPM 。 按空格键并输入软件包名称(例如webp )-然后只需等待几秒钟。 按Enter键在浏览器中...
    • npm-release
      npm-发布 该脚本执行以下操作 更新package.json中的版本 发布到npm 提交,标记并推送到存储
    • pixi-storybook:pixi-storybook npm软件包的存储
      pixi-storybook:pixi-storybook npm软件包的存储