Skip to content

Commit

Permalink
Update miniflare package README.md for version 2
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbbot committed Oct 26, 2021
1 parent a098748 commit 76cfa71
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 48 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ workers in a sandbox implementing Workers' runtime APIs.

---

<!--prettier-ignore-start-->
:::warning
⚠️ This branch is for the next major version of Miniflare, which is
under development.
:::
<!--prettier-ignore-end-->
> ⚠️ This branch is for the next major version of Miniflare, which is under
> development.
Miniflare 2 has been completely redesigned from version 1 with 3 primary design
goals:
Expand Down
127 changes: 85 additions & 42 deletions packages/miniflare/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,29 @@
It's an alternative to `wrangler dev`, written in TypeScript, that runs your
workers in a sandbox implementing Workers' runtime APIs.

**See <https://miniflare.dev> for more detailed documentation.**
**See <https://v2.miniflare.dev> for more detailed documentation.**

---

> ⚠️ This branch is for the next major version of Miniflare, which is under
> development.
Miniflare 2 has been completely redesigned from version 1 with 3 primary design
goals:

1. 📚 **Modular:** Miniflare 2 splits Workers components (KV, Durable Objects,
etc.) into **separate packages** (`@miniflare/kv`,
`@miniflare/durable-objects`, etc.) that you can import separately for
testing.
2.**Lightweight:** Miniflare 1 included
[122 third-party packages](http://npm.anvaka.com/#/view/2d/miniflare) with a
total install size of `88.3MB`. Miniflare 2 reduces this to **24 packages and
`11.5MB`** 🤯. This can probably be reduced further too.
3.**Correct:** Miniflare 2 more accurately replicates the quirks and thrown
errors of the real Workers runtime, so you'll know before you deploy if
things are going to break.

---

## Features

Expand All @@ -39,8 +61,8 @@ workers in a sandbox implementing Workers' runtime APIs.
Miniflare is installed using npm:

```shell
$ npm install -g miniflare # either globally..
$ npm install -D miniflare # ...or as a dev dependency
$ npm install -g miniflare@next # either globally..
$ npm install -D miniflare@next # ...or as a dev dependency
```

## Using the CLI
Expand Down Expand Up @@ -77,43 +99,64 @@ console.log(await res.text()); // Hello Miniflare!
```
Usage: miniflare [script] [options]
Options:
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
-H, --host HTTP server host to listen on (all by default)[string]
-p, --port HTTP server port (8787 by default) [number]
-d, --debug Log debug messages [boolean]
-c, --wrangler-config Path to wrangler.toml [string]
--wrangler-env Environment in wrangler.toml to use [string]
--package Path to package.json [string]
-m, --modules Enable modules [boolean]
--modules-rule Modules import rule (TYPE=GLOB) [array]
--build-command Command to build project [string]
--build-base-path Working directory for build command [string]
--build-watch-path Directory to watch for rebuilding on changes [string]
-w, --watch Watch files for changes [boolean]
-u, --upstream URL of upstream origin [string]
-t, --cron Cron pattern to trigger scheduled events with [array]
-k, --kv KV namespace to bind [array]
--kv-persist Path to persist KV data to (omit path for default)
--cache-persist Path to persist cached data to (omit path for default)
--disable-cache Disable caching with default/named caches [boolean]
-s, --site Path to serve Workers Site files from [string]
--site-include Glob pattern of site files to serve [array]
--site-exclude Glob pattern of site files not to serve [array]
-o, --do Durable Object to bind (NAME=CLASS) [array]
--do-persist Path to persist Durable Object data to (omit path for
default)
-e, --env Path to .env file [string]
-b, --binding Bind variable/secret (KEY=VALUE) [array]
--wasm WASM module to bind (NAME=PATH) [array]
--https Enable self-signed HTTPS
--https-key Path to PEM SSL key [string]
--https-cert Path to PEM SSL cert chain [string]
--https-ca Path to SSL trusted CA certs [string]
--https-pfx Path to PFX/PKCS12 SSL key/cert chain [string]
--https-passphrase Passphrase to decrypt SSL files [string]
--disable-updater Disable update checker [boolean]
Core Options:
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
-c, --wrangler-config Path to wrangler.toml [string]
--wrangler-env Environment in wrangler.toml to use [string]
--package Path to package.json [string]
-m, --modules Enable modules [boolean]
--modules-rule Modules import rule [array:TYPE=GLOB]
--compat-date Opt into backwards-incompatible changes from [string]
--compat-flag Control specific backwards-incompatible changes [array]
-u, --upstream URL of upstream origin [string]
-w, --watch Watch files for changes [boolean]
-d, --debug Enable debug logging [boolean]
-V, --verbose Enable verbose logging [boolean]
--(no-)update-check Enable update checker (enabled by default) [boolean]
HTTP Options:
-H, --host Host for HTTP(S) server to listen on [string]
-p, --port Port for HTTP(S) server to listen on [number]
--https Enable self-signed HTTPS (with optional cert path) [boolean/string]
--https-key Path to PEM SSL key [string]
--https-cert Path to PEM SSL cert chain [string]
--https-ca Path to SSL trusted CA certs [string]
--https-pfx Path to PFX/PKCS12 SSL key/cert chain [string]
--https-passphrase Passphrase to decrypt SSL files [string]
--(no-)cf-fetch Path for cached Request cf object from Cloudflare [boolean/string]
--live-reload Reload HTML pages whenever worker is reloaded [boolean]
Scheduler Options:
-t, --cron CRON expression for triggering scheduled events [array]
Build Options:
-B, --build-command Command to build project [string]
--build-base-path Working directory for build command [string]
--build-watch-path Directory to watch for rebuilding on changes [array]
KV Options:
-k, --kv KV namespace to bind [array]
--kv-persist Persist KV data (to optional path) [boolean/string]
Durable Objects Options:
-o, --do Durable Object to bind [array:NAME=CLASS]
--do-persist Persist Durable Object data (to optional path) [boolean/string]
Cache Options:
--(no-)cache Enable default/named caches (enabled by default) [boolean]
--cache-persist Persist cached data (to optional path) [boolean/string]
Sites Options:
-s, --site Path to serve Workers Site files from [string]
--site-include Glob pattern of site files to serve [array]
--site-exclude Glob pattern of site files not to serve [array]
Bindings Options:
-e, --env Path to .env file [string]
-b, --binding Binds variable/secret to environment [array:KEY=VALUE]
--global Binds variable/secret to global scope [array:KEY=VALUE]
--wasm WASM module to bind [array:NAME=PATH]
```

## Acknowledgements
Expand All @@ -127,5 +170,5 @@ for inspiration.
Durable Object's transactions are implemented using Optimistic Concurrency
Control (OCC) as described in
["On optimistic methods for concurrency control." ACM Transactions on Database Systems](https://dl.acm.org/doi/10.1145/319566.319567).
Thanks to [Alistair O'Brien](https://github.com/johnyob) for helping me
understand this.
Thanks to [Alistair O'Brien](https://github.com/johnyob) for helping the
Miniflare author understand this.

0 comments on commit 76cfa71

Please sign in to comment.