Skip to content

Commit

Permalink
[docs] update adapter READMESs to include astro add (#4595)
Browse files Browse the repository at this point in the history
* update adapter READMES to include astro add

* missing space

Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>

Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
  • Loading branch information
3 people authored Sep 6, 2022
1 parent 6506e84 commit 5231ec0
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 71 deletions.
20 changes: 17 additions & 3 deletions packages/integrations/cloudflare/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@

An SSR adapter for use with Cloudflare Pages Functions targets. Write your code in Astro/Javascript and deploy to Cloudflare Pages.

Learn how to deploy your Astro site in our [Cloudflare Pages deployment guide](https://docs.astro.build/en/guides/deploy/cloudflare/).
## Install

In your `astro.config.mjs` use:
Add the Cloudflare adapter to enable SSR in your Astro project with the following `astro add` command. This will install the adapter and make the appropriate changes to your `astro.config.mjs` file in one step.

```js
```bash
npx astro add cloudflare
```

If you prefer to install the adapter manually instead, complete the following two steps:

1. Add the Cloudflare adapter to your project's dependencies using your preferred package manager. If you’re using npm or aren’t sure, run this in the terminal:

```bash
npm install @astrojs/cloudflare
```

2. Add the following to your `astro.config.mjs` file:

```js title="astro.config.mjs" ins={2, 5-6}
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';

Expand Down
62 changes: 45 additions & 17 deletions packages/integrations/deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,54 @@ If you wish to [use server-side rendering (SSR)](https://docs.astro.build/en/gui

## Installation

First, install the `@astrojs/deno` package using your package manager. If you're using npm or aren't sure, run this in the terminal:
Add the Deno adapter to enable SSR in your Astro project with the following `astro add` command. This will install the adapter and make the appropriate changes to your `astro.config.mjs` file in one step.

```sh
npm install @astrojs/deno
```bash
npx astro add deno
```

Then, install this adapter in your `astro.config.*` file using the `adapter` property:

__`astro.config.mjs`__

```js
import { defineConfig } from 'astro/config';
import deno from '@astrojs/deno';

export default defineConfig({
// ...
output: 'server',
adapter: deno()
});
```
If you prefer to install the adapter manually instead, complete the following two steps:

1. Install the Deno adapter to your project’s dependencies using your preferred package manager. If you’re using npm or aren’t sure, run this in the terminal:

```bash
npm install @astrojs/deno
```

1. Update your `astro.config.mjs` project configuration file with the changes below.

```js ins={3,6-7}
// astro.config.mjs
import { defineConfig } from 'astro/config';
import deno from '@astrojs/deno';
export default defineConfig({
output: 'server',
adapter: deno(),
});
```
Next, Update your `preview` script in `package.json` with the change below.
```json del={8} ins={9}
// package.json
{
// ...
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview"
"preview": "deno run --allow-net --allow-read --allow-env ./dist/server/entry.mjs"
}
}
```
You can now use this command to preview your production Astro site locally with Deno.
```bash
npm run preview
```
## Usage
Expand Down
54 changes: 31 additions & 23 deletions packages/integrations/netlify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,47 @@ If you wish to [use server-side rendering (SSR)](https://docs.astro.build/en/gui

## Installation

First, install the `@astrojs/netlify` package using your package manager. If you're using npm or aren't sure, run this in the terminal:
```sh
npm install @astrojs/netlify
Add the Netlify adapter to enable SSR in your Astro project with the following `astro add` command. This will install the adapter and make the appropriate changes to your `astro.config.mjs` file in one step.

```bash
npx astro add netlify
```

Then, install this adapter in your `astro.config.*` file using the `adapter` property. Note: there are two different adapters, one for Netlify Functions and one for Edge Functions. See [Edge Functions](#edge-functions) below on importing the latter.
If you prefer to install the adapter manually instead, complete the following two steps:

__`astro.config.mjs`__
1. Install the Netlify adapter to your project’s dependencies using your preferred package manager. If you’re using npm or aren’t sure, run this in the terminal:

```js
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/functions';
```bash
npm install @astrojs/netlify
```

export default defineConfig({
output: 'server',
adapter: netlify(),
});
```
1. Add two new lines to your `astro.config.mjs` project configuration file.

```js title="astro.config.mjs" ins={2, 5-6}
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/functions';
export default defineConfig({
output: 'server',
adapter: netlify(),
});
```
### Edge Functions
Netlify has two serverless platforms, Netlify Functions and Netlify Edge Functions. With Edge Functions your code is distributed closer to your users, lowering latency. You can use Edge Functions by changing the import in your astro configuration file:
Netlify has two serverless platforms, Netlify Functions and [Netlify's experimental Edge Functions](https://docs.netlify.com/netlify-labs/experimental-features/edge-functions/#app). With Edge Functions your code is distributed closer to your users, lowering latency. You can use Edge Functions by changing the `netlify/functions` import in the Astro config file to use `netlify/edge-functions`.
```diff
import { defineConfig } from 'astro/config';
- import netlify from '@astrojs/netlify/functions';
+ import netlify from '@astrojs/netlify/edge-functions';
```js title="astro.config.mjs" ins={3} del={2}
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/functions';
import netlify from '@astrojs/netlify/edge-functions';
export default defineConfig({
output: 'server',
adapter: netlify(),
});
```
export default defineConfig({
output: 'server',
adapter: netlify(),
});
```
## Usage
[Read the full deployment guide here.](https://docs.astro.build/en/guides/deploy/netlify/)
Expand Down
35 changes: 20 additions & 15 deletions packages/integrations/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,31 @@ If you wish to [use server-side rendering (SSR)](https://docs.astro.build/en/gui

## Installation

First, install the `@astrojs/node` package using your package manager. If you're using npm or aren't sure, run this in the terminal:
Add the Node adapter to enable SSR in your Astro project with the following `astro add` command. This will install the adapter and make the appropriate changes to your `astro.config.mjs` file in one step.

```sh
npm install @astrojs/node
```bash
npx astro add node
```

Then, install this adapter in your `astro.config.*` file using the `adapter` property:
If you prefer to install the adapter manually instead, complete the following two steps:

__`astro.config.mjs`__
1. Install the Node adapter to your project’s dependencies using your preferred package manager. If you’re using npm or aren’t sure, run this in the terminal:

```js
import { defineConfig } from 'astro/config';
import node from '@astrojs/node';

export default defineConfig({
// ...
output: 'server',
adapter: node()
})
```
```bash
npm install @astrojs/node
```

1. Add two new lines to your `astro.config.mjs` project configuration file.

```js title="astro.config.mjs" ins={2, 5-6}
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/node';
export default defineConfig({
output: 'server',
adapter: node(),
});
```
## Usage
Expand Down
33 changes: 20 additions & 13 deletions packages/integrations/vercel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,31 @@ If you wish to [use server-side rendering (SSR)](https://docs.astro.build/en/gui

## Installation

First, install the `@astrojs/vercel` package using your package manager. If you're using npm or aren't sure, run this in the terminal:
```sh
npm install @astrojs/vercel
Add the Vercel adapter to enable SSR in your Astro project with the following `astro add` command. This will install the adapter and make the appropriate changes to your `astro.config.mjs` file in one step.

```bash
npx astro add vercel
```

Then, install this adapter in your `astro.config.*` file using the `deploy` property (note the import from `@astrojs/vercel/serverless` - see [targets](#targets)).
If you prefer to install the adapter manually instead, complete the following two steps:

__`astro.config.mjs`__
1. Install the Vercel adapter to your project’s dependencies using your preferred package manager. If you’re using npm or aren’t sure, run this in the terminal:

```js
import { defineConfig } from 'astro/config';
import vercel from '@astrojs/vercel/serverless';
```bash
npm install @astrojs/vercel
```

export default defineConfig({
output: 'server',
adapter: vercel()
});
```
1. Add two new lines to your `astro.config.mjs` project configuration file.

```js title="astro.config.mjs" ins={2, 5-6}
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/vercel/serverless';
export default defineConfig({
output: 'server',
adapter: vercel(),
});
```
### Targets
Expand Down

0 comments on commit 5231ec0

Please sign in to comment.