0.0.4 • Published 3 years ago

@cfpreview/pages-cli v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

[Beta] Pages CLI

$ npm install @cfpreview/pages-cli
$ pages dev [directory | -- command]

Examples

Create React App

$ pages dev --proxy 3000 -- npx react-scripts start

A static folder

$ pages dev ./public

Options

NameDescriptionDefault
--portThe port to listen on.7000
--proxyThe port to proxy requests for env.ASSETS.fetch to.Automatically determined by inspecting command process.
--configThe path to the beta configuration file../pages-functions-beta.json

Miniflare

Inside your pages-functions-beta.json file, you can add a "miniflare" object which is passed into the constructor of Miniflare:

{
  "entryPoint": "./functions",
  "baseURL": "/",
  "miniflare": {
    "kvPersist": true,
    "kvNamespaces": ["MyKVNamespace"]
  }
}

You can use this to enable environment variables and secret bindings, custom build commands for single Worker setups, KV, and Durable Objects.

Note: this is only for local development and has no impact on any production settings.

Roadmap

  • Improve help message (the -- command option presents weirdly)
  • Auto-configure --proxy based on command run
    • Testing on Windows
  • Bindings
  • Custom build scripts for single Worker setups