Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit a098748

Browse files
committed
Update README.md for version 2
1 parent c4024a2 commit a098748

File tree

1 file changed

+89
-42
lines changed

1 file changed

+89
-42
lines changed

README.md

Lines changed: 89 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,33 @@
1313
It's an alternative to `wrangler dev`, written in TypeScript, that runs your
1414
workers in a sandbox implementing Workers' runtime APIs.
1515

16-
**See <https://miniflare.dev> for more detailed documentation.**
16+
**See <https://v2.miniflare.dev> for more detailed documentation.**
17+
18+
---
19+
20+
<!--prettier-ignore-start-->
21+
:::warning
22+
⚠️ This branch is for the next major version of Miniflare, which is
23+
under development.
24+
:::
25+
<!--prettier-ignore-end-->
26+
27+
Miniflare 2 has been completely redesigned from version 1 with 3 primary design
28+
goals:
29+
30+
1. 📚 **Modular:** Miniflare 2 splits Workers components (KV, Durable Objects,
31+
etc.) into **separate packages** (`@miniflare/kv`,
32+
`@miniflare/durable-objects`, etc.) that you can import separately for
33+
testing.
34+
2.**Lightweight:** Miniflare 1 included
35+
[122 third-party packages](http://npm.anvaka.com/#/view/2d/miniflare) with a
36+
total install size of `88.3MB`. Miniflare 2 reduces this to **24 packages and
37+
`11.5MB`** 🤯. This can probably be reduced further too.
38+
3.**Correct:** Miniflare 2 more accurately replicates the quirks and thrown
39+
errors of the real Workers runtime, so you'll know before you deploy if
40+
things are going to break.
41+
42+
---
1743

1844
## Features
1945

@@ -39,8 +65,8 @@ workers in a sandbox implementing Workers' runtime APIs.
3965
Miniflare is installed using npm:
4066

4167
```shell
42-
$ npm install -g miniflare # either globally..
43-
$ npm install -D miniflare # ...or as a dev dependency
68+
$ npm install -g miniflare@next # either globally..
69+
$ npm install -D miniflare@next # ...or as a dev dependency
4470
```
4571

4672
## Using the CLI
@@ -77,43 +103,64 @@ console.log(await res.text()); // Hello Miniflare!
77103
```
78104
Usage: miniflare [script] [options]
79105
80-
Options:
81-
-h, --help Show help [boolean]
82-
-v, --version Show version number [boolean]
83-
-H, --host HTTP server host to listen on (all by default)[string]
84-
-p, --port HTTP server port (8787 by default) [number]
85-
-d, --debug Log debug messages [boolean]
86-
-c, --wrangler-config Path to wrangler.toml [string]
87-
--wrangler-env Environment in wrangler.toml to use [string]
88-
--package Path to package.json [string]
89-
-m, --modules Enable modules [boolean]
90-
--modules-rule Modules import rule (TYPE=GLOB) [array]
91-
--build-command Command to build project [string]
92-
--build-base-path Working directory for build command [string]
93-
--build-watch-path Directory to watch for rebuilding on changes [string]
94-
-w, --watch Watch files for changes [boolean]
95-
-u, --upstream URL of upstream origin [string]
96-
-t, --cron Cron pattern to trigger scheduled events with [array]
97-
-k, --kv KV namespace to bind [array]
98-
--kv-persist Path to persist KV data to (omit path for default)
99-
--cache-persist Path to persist cached data to (omit path for default)
100-
--disable-cache Disable caching with default/named caches [boolean]
101-
-s, --site Path to serve Workers Site files from [string]
102-
--site-include Glob pattern of site files to serve [array]
103-
--site-exclude Glob pattern of site files not to serve [array]
104-
-o, --do Durable Object to bind (NAME=CLASS) [array]
105-
--do-persist Path to persist Durable Object data to (omit path for
106-
default)
107-
-e, --env Path to .env file [string]
108-
-b, --binding Bind variable/secret (KEY=VALUE) [array]
109-
--wasm WASM module to bind (NAME=PATH) [array]
110-
--https Enable self-signed HTTPS
111-
--https-key Path to PEM SSL key [string]
112-
--https-cert Path to PEM SSL cert chain [string]
113-
--https-ca Path to SSL trusted CA certs [string]
114-
--https-pfx Path to PFX/PKCS12 SSL key/cert chain [string]
115-
--https-passphrase Passphrase to decrypt SSL files [string]
116-
--disable-updater Disable update checker [boolean]
106+
Core Options:
107+
-h, --help Show help [boolean]
108+
-v, --version Show version number [boolean]
109+
-c, --wrangler-config Path to wrangler.toml [string]
110+
--wrangler-env Environment in wrangler.toml to use [string]
111+
--package Path to package.json [string]
112+
-m, --modules Enable modules [boolean]
113+
--modules-rule Modules import rule [array:TYPE=GLOB]
114+
--compat-date Opt into backwards-incompatible changes from [string]
115+
--compat-flag Control specific backwards-incompatible changes [array]
116+
-u, --upstream URL of upstream origin [string]
117+
-w, --watch Watch files for changes [boolean]
118+
-d, --debug Enable debug logging [boolean]
119+
-V, --verbose Enable verbose logging [boolean]
120+
--(no-)update-check Enable update checker (enabled by default) [boolean]
121+
122+
HTTP Options:
123+
-H, --host Host for HTTP(S) server to listen on [string]
124+
-p, --port Port for HTTP(S) server to listen on [number]
125+
--https Enable self-signed HTTPS (with optional cert path) [boolean/string]
126+
--https-key Path to PEM SSL key [string]
127+
--https-cert Path to PEM SSL cert chain [string]
128+
--https-ca Path to SSL trusted CA certs [string]
129+
--https-pfx Path to PFX/PKCS12 SSL key/cert chain [string]
130+
--https-passphrase Passphrase to decrypt SSL files [string]
131+
--(no-)cf-fetch Path for cached Request cf object from Cloudflare [boolean/string]
132+
--live-reload Reload HTML pages whenever worker is reloaded [boolean]
133+
134+
Scheduler Options:
135+
-t, --cron CRON expression for triggering scheduled events [array]
136+
137+
Build Options:
138+
-B, --build-command Command to build project [string]
139+
--build-base-path Working directory for build command [string]
140+
--build-watch-path Directory to watch for rebuilding on changes [array]
141+
142+
KV Options:
143+
-k, --kv KV namespace to bind [array]
144+
--kv-persist Persist KV data (to optional path) [boolean/string]
145+
146+
Durable Objects Options:
147+
-o, --do Durable Object to bind [array:NAME=CLASS]
148+
--do-persist Persist Durable Object data (to optional path) [boolean/string]
149+
150+
Cache Options:
151+
--(no-)cache Enable default/named caches (enabled by default) [boolean]
152+
--cache-persist Persist cached data (to optional path) [boolean/string]
153+
154+
Sites Options:
155+
-s, --site Path to serve Workers Site files from [string]
156+
--site-include Glob pattern of site files to serve [array]
157+
--site-exclude Glob pattern of site files not to serve [array]
158+
159+
Bindings Options:
160+
-e, --env Path to .env file [string]
161+
-b, --binding Binds variable/secret to environment [array:KEY=VALUE]
162+
--global Binds variable/secret to global scope [array:KEY=VALUE]
163+
--wasm WASM module to bind [array:NAME=PATH]
117164
```
118165

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

0 commit comments

Comments
 (0)