@cfworker/dev
Run, test and deploy Cloudflare workers
Last updated 10 hours ago by jdanyow .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @cfworker/dev 
SYNC missed versions from official npm registry.

@cfworker/dev

Run, test and deploy Cloudflare workers. Opinionated CLI for Cloudflare Worker development and deployment. Uses Rollup for clean packaging of code and dependencies and .env files for secret management. Supports JavaScript or TypeScript with process.env.* environment variable substitution with zero configuration. Simulates the Cloudflare Worker runtime using puppeteer, restricting access to the subset of APIs supported in workers.

Create a .env file (and optionally a .env.production file) at the root of your project with the following values:

CLOUDFLARE_EMAIL=xxxxxxxxxxxxxxx
CLOUDFLARE_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CLOUDFLARE_ZONE_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CLOUDFLARE_ACCOUNT_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CLOUDFLARE_WORKERS_DEV_PROJECT=xxxxxx

Usage:

cfworker [options] [command]

Options:
  -V, --version                    output the version number
  -h, --help                       output usage information

Commands:
  test [options] [input...]        run tests
  run [options] [input...]         run worker script
  deploy-dev [options] [input...]  deploy worker script to workers.dev
  deploy [options] [input...]      deploy worker script
  build [options] [input...]       build worker script
  info                             Prints debugging information about the local environment
  help [command]                   display help information for a command

  Run `cfworker help <command>` for more information on specific commands

run

Bundle and run a worker script.

Usage:

cfworker run [options] [input...]

Options:

  -p, --port <port>  set the port to serve on (default: 7000)
  -w, --watch        enable watch mode (default: false)
  -i, --inspect      open browser window with devtools enabled (default: false)
  -h, --help         output usage information

Examples:

cfworker run worker.js

cfworker run --watch src/index.ts

cfworker run --watch --inspect src/worker.js

test

Write tests using mocha and chai, then use the cfworker test command to run the tests in a simulated Cloudflare Worker runtime.

Usage:

cfworker test [options] [globs...]

Options:

  -p, --port <port>  set the port to serve on (default: 7000)
  -w, --watch        enable watch mode (default: false)
  -i, --inspect      open browser window with devtools enabled (default: false)
  -h, --help         output usage information

Examples:

cfworker test ./test/**/*.spec.ts

cfworker test ./test/**/*.spec.js

cfworker test --watch --inspect ./test/**/*.spec.ts

Here's an example test file: packages/base64url/test/index.spec.ts

build

Build/bundle a worker script and output the result to a file.

Usage:

cfworker build [options] [input...]

Options:

  -o, --out-file <filename>  the output filename (default: "dist/worker.js")
  -w, --watch                enable watch mode (default: false)
  -h, --help                 output usage information

Examples:

cfworker build src/index.ts --out-file dist/index.js

Current Tags

  • 1.2.0                                ...           latest (10 hours ago)

13 Versions

  • 1.2.0                                ...           10 hours ago
  • 1.1.4                                ...           18 days ago
  • 1.1.3                                ...           21 days ago
  • 1.1.2                                ...           2 months ago
  • 1.1.1                                ...           2 months ago
  • 1.1.0                                ...           3 months ago
  • 1.0.11                                ...           5 months ago
  • 1.0.10                                ...           5 months ago
  • 1.0.9                                ...           5 months ago
  • 1.0.5                                ...           5 months ago
  • 1.0.4                                ...           5 months ago
  • 1.0.1                                ...           5 months ago
  • 1.0.0                                ...           5 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 45
Last Day 8
Last Week 20
Last Month 20
Dependencies (17)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |