-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add miniflare docs #18690
Add miniflare docs #18690
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
22 files reviewed, 30 total issue(s) found.
Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
21 files reviewed, 10 total issue(s) found.
Note: We resolved prior Hyperlint review comments because:
We updated our inline suggestion AI.
We do this to avoid keeping outdated or irrelevant comments around. We'll leave a new review with current comments below.
Deploying cloudflare-docs with Cloudflare Pages
|
@@ -1,466 +0,0 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of removing this whole page, let's perhaps keep it in a more condensed form, and keep stuff that is relevant to miniflare 3, and remove all the miniflare 2 specific bits 🙏
@@ -25,12 +25,7 @@ TypeScript, and runs your code in a sandbox implementing Workers' runtime APIs. | |||
- ⚡ **Fully-local:** test and develop Workers without an internet connection. | |||
Reload code on change quickly. | |||
|
|||
<LinkButton variant="primary" href="/workers/get-started/guide/"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we keep the get started page, we'll prolly wanna keep the btn as well :)
@@ -1,6 +1,6 @@ | |||
--- | |||
order: 3 | |||
title: ⬆️ Migrating from Version 2 | |||
title: ⬆️Migrating from Version 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-add the space here
@@ -30,15 +30,10 @@ please open an issue on | |||
|
|||
We have tried to keep Miniflare v3’s API close to Miniflare v2 where possible, | |||
but many options and methods have been removed or changed with the switch to the | |||
open-source `workerd` runtime. See the | |||
[Getting Started guide for the new API docs](/get-started). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should add this get started link back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
23 files reviewed, 7 total issue(s) found.
## Manipulating Outside Workers | ||
|
||
For testing, it can be useful to put/get data from R2 storage | ||
outside a worker. You can do this with the `getR2Bucket` method: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outside a worker. You can do this with the `getR2Bucket` method: | |
outside a Worker. You can do this with the `getR2Bucket` method: |
Issues:
- Style Guide - (Terms-error) Use 'Worker' instead of 'worker'.
Fix Explanation:
The term 'worker' should be capitalized to 'Worker' as per the style guide recommendation. It is not a code reference, so the correction is applicable.
## Using a Class Exported by Another Script | ||
|
||
Miniflare supports the `script_name` option for accessing Durable Objects | ||
exported by other scripts. This requires mounting the other worker as described |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported by other scripts. This requires mounting the other worker as described | |
exported by other scripts. This requires mounting the other Worker as described |
Issues:
- Style Guide - (Terms-error) Use 'Worker' instead of 'worker'.
Fix Explanation:
The term 'worker' should be capitalized to 'Worker' as per the style guide recommendation. This is a straightforward capitalization fix.
title: Get Started | ||
--- | ||
|
||
The Miniflare API allows you to dispatch events to workers without making actual HTTP requests, simulate connections between Workers, and interact with local emulations of storage products like [KV](/storage/kv), [R2](/storage/r2), and [Durable Objects](/storage/durable-objects). This makes it great for writing tests, or other advanced use cases where you need finer-grained control. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Miniflare API allows you to dispatch events to workers without making actual HTTP requests, simulate connections between Workers, and interact with local emulations of storage products like [KV](/storage/kv), [R2](/storage/r2), and [Durable Objects](/storage/durable-objects). This makes it great for writing tests, or other advanced use cases where you need finer-grained control. | |
The Miniflare API allows you to dispatch events to Workers without making actual HTTP requests, simulate connections between Workers, and interact with local emulations of storage products like [KV](/storage/kv), [R2](/storage/r2), and [Durable Objects](/storage/durable-objects). This makes it great for writing tests, or other advanced use cases where you need finer-grained control. |
Issues:
- Style Guide - (Terms-error) Use 'Workers' instead of 'workers'.
Fix Explanation:
The term 'workers' should be capitalized to 'Workers' as per the style guide recommendation. This is not a code reference, so the correction is valid.
### Dispatching Events | ||
|
||
`getWorker` dispatches `fetch`, `queues`, and `scheduled` events | ||
to workers respectively: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to workers respectively: | |
to Workers respectively: |
Issues:
- Style Guide - (Terms-error) Use 'Workers' instead of 'workers'.
Fix Explanation:
The capitalization of 'workers' should be corrected to 'Workers' as per the style guide recommendation.
- `globals` | ||
- Injecting arbitrary globals is not supported by | ||
[`workerd`](https://github.com/cloudflare/workerd). If you're using a | ||
service worker, `bindings` will be injected as globals, but these must be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
service worker, `bindings` will be injected as globals, but these must be | |
service Worker, `bindings` will be injected as globals, but these must be |
Issues:
- Style Guide - (Terms-error) Use 'Worker' instead of 'worker'.
Fix Explanation:
The style guide suggests capitalizing 'Worker'. Since 'worker' is not a code reference, we should follow the recommendation and capitalize it.
}); | ||
``` | ||
|
||
You can now access KV namespaces in your workers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can now access KV namespaces in your workers: | |
You can now access KV namespaces in your Workers: |
Issues:
- Style Guide - (Terms-error) Use 'Workers' instead of 'workers'.
Fix Explanation:
The term 'workers' should be capitalized as 'Workers' according to the style guide recommendation. This is not a code reference, so the capitalization correction is appropriate.
|
||
## Manipulating Outside Workers | ||
|
||
For testing, it can be useful to put/get data from KV outside a worker. You can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For testing, it can be useful to put/get data from KV outside a worker. You can | |
For testing, it can be useful to put/get data from KV outside a Worker. You can |
Issues:
- Style Guide - (Terms-error) Use 'Worker' instead of 'worker'.
Fix Explanation:
The word 'worker' should be capitalized to 'Worker' as per the style guide recommendation. This is a straightforward capitalization fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much @penalosa for working on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be top-level in dev docs:
And certainly not above other content that is currently below it.
Suggestion would be:
- The content itself is part of
/workers/testing
— we already talk about Miniflare here. - It should be linked to from
/workers/wrangler/api
Docs for Miniflare lead with:
Things in the left-hand nav of Workers docs should be things that in the base case, people building Workers need to interact with and understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
24 files reviewed, 7 total issue(s) found.
- `globals` | ||
- Injecting arbitrary globals is not supported by | ||
[`workerd`](https://github.com/cloudflare/workerd). If you're using a | ||
service worker, `bindings` will be injected as globals, but these must be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
service worker, `bindings` will be injected as globals, but these must be | |
service Worker, `bindings` will be injected as globals, but these must be |
Issues:
- Style Guide - (Terms-error) Use 'Worker' instead of 'worker'.
Fix Explanation:
The word 'worker' should be capitalized to 'Worker' as per the style guide recommendation. It is not a code reference, so the correction is valid.
## Manipulating Outside Workers | ||
|
||
For testing, it can be useful to put/get data from R2 storage | ||
outside a worker. You can do this with the `getR2Bucket` method: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outside a worker. You can do this with the `getR2Bucket` method: | |
outside a Worker. You can do this with the `getR2Bucket` method: |
Issues:
- Style Guide - (Terms-error) Use 'Worker' instead of 'worker'.
Fix Explanation:
The term 'worker' should be capitalized to 'Worker' as per the style guide recommendation since it is not a code reference.
## Using a Class Exported by Another Script | ||
|
||
Miniflare supports the `script_name` option for accessing Durable Objects | ||
exported by other scripts. This requires mounting the other worker as described |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported by other scripts. This requires mounting the other worker as described | |
exported by other scripts. This requires mounting the other Worker as described |
Issues:
- Style Guide - (Terms-error) Use 'Worker' instead of 'worker'.
Fix Explanation:
The capitalization of 'worker' to 'Worker' is recommended by the style guide and is not part of any code reference or special syntax, so it should be corrected.
title: Get Started | ||
--- | ||
|
||
The Miniflare API allows you to dispatch events to workers without making actual HTTP requests, simulate connections between Workers, and interact with local emulations of storage products like [KV](/workers/miniflare/storage/kv), [R2](/workers/miniflare/storage/r2), and [Durable Objects](/workers/miniflare/storage/durable-objects). This makes it great for writing tests, or other advanced use cases where you need finer-grained control. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Miniflare API allows you to dispatch events to workers without making actual HTTP requests, simulate connections between Workers, and interact with local emulations of storage products like [KV](/workers/miniflare/storage/kv), [R2](/workers/miniflare/storage/r2), and [Durable Objects](/workers/miniflare/storage/durable-objects). This makes it great for writing tests, or other advanced use cases where you need finer-grained control. | |
The Miniflare API allows you to dispatch events to Workers without making actual HTTP requests, simulate connections between Workers, and interact with local emulations of storage products like [KV](/workers/miniflare/storage/kv), [R2](/workers/miniflare/storage/r2), and [Durable Objects](/workers/miniflare/storage/durable-objects). This makes it great for writing tests, or other advanced use cases where you need finer-grained control. |
Issues:
- Style Guide - (Terms-error) Use 'Workers' instead of 'workers'.
Fix Explanation:
The term 'Workers' should be capitalized as it refers to a specific product or service, consistent with the style guide's recommendation.
### Dispatching Events | ||
|
||
`getWorker` dispatches `fetch`, `queues`, and `scheduled` events | ||
to workers respectively: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to workers respectively: | |
to Workers respectively: |
Issues:
- Style Guide - (Terms-error) Use 'Workers' instead of 'workers'.
Fix Explanation:
The review process identified a capitalization issue, recommending 'Workers' instead of 'workers'. This is a straightforward capitalization correction, and the guidelines instruct us to follow the recommendation in such cases.
}); | ||
``` | ||
|
||
You can now access KV namespaces in your workers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can now access KV namespaces in your workers: | |
You can now access KV namespaces in your Workers: |
Issues:
- Style Guide - (Terms-error) Use 'Workers' instead of 'workers'.
Fix Explanation:
The style guide suggests capitalizing 'Workers'. Since it is not a code reference, the capitalization should be corrected.
|
||
## Manipulating Outside Workers | ||
|
||
For testing, it can be useful to put/get data from KV outside a worker. You can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For testing, it can be useful to put/get data from KV outside a worker. You can | |
For testing, it can be useful to put/get data from KV outside a Worker. You can |
Issues:
- Style Guide - (Terms-error) Use 'Worker' instead of 'worker'.
Fix Explanation:
The capitalization of 'worker' should be corrected to 'Worker' as per the style guide recommendation. This is not a code reference, so the change is appropriate.
@irvinebroque I've moved it to the testing folder. I'm a bit hesitant to link to it from Wrangler's API page though, since for most users it won't provide what they want from an API (especially for a Wrangler user, since it won't read their Wrangler config file). What do you think? |
@penalosa I'm good with that |
Adds the contents of https://miniflare.dev/, with non-relevant sections removed/modified. There are two commits—one with a full import of the content, and one with sections removed.
I imagine this will be a process of keeping these up to date and making them more detailed, but this should be a good start to allow us to retire https://miniflare.dev/ and the Miniflare 2 repo.