Skip to content

Commit

Permalink
[Docs]: Update Cloudflare README (#4232)
Browse files Browse the repository at this point in the history
* update cloudflare readme

* Create modern-papayas-rhyme.md

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
  • Loading branch information
Obinna Ekwuno and natemoo-re authored Aug 10, 2022
1 parent 0af5aa7 commit bfbd325
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/modern-papayas-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/cloudflare": patch
---

Update README
5 changes: 3 additions & 2 deletions packages/integrations/cloudflare/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Cloudflare Pages has 2 different modes for deploying functions, `advanced` mode

For most projects the adaptor default of `advanced` will be sufficiant, when in this mode the `dist` folder will contain your compiled project. However if you'd like to use [pages plugins](https://developers.cloudflare.com/pages/platform/functions/plugins/) such as [Sentry](https://developers.cloudflare.com/pages/platform/functions/plugins/sentry/) for example to enable logging, you'll need to use directory mode.

In directory mode the adaptor will compile the client side part of you app the same way, but it will move the worker script into a `functions` folder in the project root. The adaptor will only ever place a `[[path]].js` in that folder, allowing you to add additional plugins and pages middlewhere which can be checked into version control .
In directory mode the adaptor will compile the client side part of you app the same way, but it will move the worker script into a `functions` folder in the project root. The adaptor will only ever place a `[[path]].js` in that folder, allowing you to add additional plugins and pages middleware which can be checked into version control.

```ts
// directory mode
Expand All @@ -45,7 +45,7 @@ In order for preview to work you must install `wrangler`
$ pnpm install wrangler --save-dev
```

It's then possible to update the preview script in your `package.json` to `"preview": "wrangler pages dev ./dist"`
It's then possible to update the preview script in your `package.json` to `"preview": "wrangler pages dev ./dist"`.This will allow you run your entire application locally with [Wrangler](https://github.com/cloudflare/wrangler2), which supports secrets, environment variables, KV namespaces, Durable Objects and [all other supported Cloudflare bindings](https://developers.cloudflare.com/pages/platform/functions/#adding-bindings).

## Streams

Expand All @@ -54,3 +54,4 @@ Some integrations such as [React](https://github.com/withastro/astro/tree/main/p
In order to work around this:
- install the `"web-streams-polyfill"` package
- add `import "web-streams-polyfill/es2018";` to the top of the front matter of every page which requires streams, such as server rendering a React component.

0 comments on commit bfbd325

Please sign in to comment.