Skip to content

Commit

Permalink
Merge branch 'main' into cc-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
juliamrch committed Sep 18, 2024
2 parents c4c8773 + 30f81ea commit caaba37
Show file tree
Hide file tree
Showing 51 changed files with 629 additions and 619 deletions.
6 changes: 3 additions & 3 deletions src/content/docs/de/guides/deploy/deno.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ npx astro add deno

Wenn du den Adapter stattdessen lieber manuell installieren möchtest, führe die folgenden zwei Schritte aus:

1. Installiere [den `@astrojs/deno`-Adapter](https://github.com/withastro/astro/tree/main/packages/integrations/deno) mit deinem bevorzugten Paketmanager als Abhängigkeit deines Projekts. Wenn du npm verwendest oder dir nicht sicher bist, führe dies im Terminal aus:
1. Installiere [den `@deno/astro-adapter`-Adapter](https://github.com/withastro/astro/tree/main/packages/integrations/deno) mit deinem bevorzugten Paketmanager als Abhängigkeit deines Projekts. Wenn du npm verwendest oder dir nicht sicher bist, führe dies im Terminal aus:

```bash
npm install @astrojs/deno
npm install @deno/astro-adapter
```

1. Aktualisiere deine Projektkonfigurationsdatei `astro.config.mjs` mit den folgenden Änderungen.

```js ins={3,6-7}
// astro.config.mjs
import { defineConfig } from 'astro/config';
import deno from '@astrojs/deno';
import deno from '@deno/astro-adapter';
export default defineConfig({
output: 'server',
Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/en/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ hero:
tagline: Powered by Astro and our open-source contributors.
linkText: Join us!
link: /en/contribute/
banner:
content: Want to try Astro 5 beta? Read our <a href="https://5-0-0-beta.docs.astro.build/en/guides/upgrade-to/v5/">v5 upgrade guide</a>!
---

import { CardGrid } from '@astrojs/starlight/components'
Expand Down
34 changes: 34 additions & 0 deletions src/content/docs/en/guides/astro-db.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,12 @@ See the [Drizzle `db.batch()`](https://orm.drizzle.team/docs/batch-api) docs for
## Astro Studio
</StudioHeading>
:::caution
We are [winding down Astro Studio](https://astro.build/blog/goodbye-astro-studio/). As a result, users will no longer be able to create databases after October 1, 2024.
We recommend [migrating your existing Studio databases to Turso](#migrate-from-astro-studio-to-turso), or [connecting Astro DB to any libSQL server](#libsql) instead.
:::
Astro DB can connect to the Astro Studio platform to quickly add a hosted database to your project. You can view, manage and deploy new hosted databases all from the Astro Studio dashboard.
The [Astro Studio web portal](http://studio.astro.build) allows you to connect to and manage your remote hosted Astro DB databases through a web interface or using [CLI commands](/en/reference/cli-reference/#astro-studio-cli).
Expand Down Expand Up @@ -655,6 +661,34 @@ When you're ready to deploy, see our [Deploy with a Studio Connection guide](#de
</ReadMore>
### Migrate from Astro Studio to Turso
<Steps>
1. In the [Studio dashboard](https://studio.astro.build/), navigate to the project you wish to migrate. In the settings tab, use the "Export Database" button to download a dump of your database.
2. Follow the official instructions to [install the Turso CLI](https://docs.turso.tech/cli/installation) and [sign up or log in](https://docs.turso.tech/cli/authentication) to your Turso account.
3. Create a new database using the `.sql` dump you downloaded in step 1.
```sh
turso db create [database-name] --from-dump ./path/to/dump.sql
```
4. Fetch the database URL using the Turso CLI, and use it as the environment variable `ASTRO_DB_REMOTE_URL`.
```sh
turso db show [database-name]
```
```env
ASTRO_DB_REMOTE_URL=[your-database-url]
```
5. Create a token to access your database, and use it as the environment variable `ASTRO_DB_APP_TOKEN`.
```sh
turso db tokens create [database-name]
```
```env
ASTRO_DB_APP_TOKEN=[your-app-token]
```
6. Once you have confirmed your project connects to the new database, you can safely delete the project from Astro Studio.
</Steps>
## libSQL
<p><Since pkg="@astrojs/db" v="0.14.0" /></p>
Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/en/guides/content-collections.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: >-
Content collections help organize your Markdown and type-check your
frontmatter with schemas.
i18nReady: true
banner:
content: Want to try the new content collections? <a href="https://5-0-0-beta.docs.astro.build/en/guides/upgrade-to/v5/">Upgrade to the v5 beta</a>!
---
import { FileTree } from '@astrojs/starlight/components';
import Since from '~/components/Since.astro'
Expand Down
6 changes: 3 additions & 3 deletions src/content/docs/en/guides/deploy/deno.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ npx astro add deno
If you prefer to install the adapter manually instead, complete the following two steps:

<Steps>
1. Install [the `@astrojs/deno` adapter][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:
1. Install [the `@deno/astro-adapter` adapter][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
npm install @deno/astro-adapter
```

2. 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';
import deno from '@deno/astro-adapter';
export default defineConfig({
output: 'server',
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/en/guides/integrations-guide/deno.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: '@astrojs/deno'
title: '@deno/astro-adapter'
description: The Deno Astro adapter
i18nReady: true
---
Expand Down
14 changes: 7 additions & 7 deletions src/content/docs/en/guides/markdown-content.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import { Steps } from '@astrojs/starlight/components';

In Astro, you can author content in Markdown, then render it in `.astro` components. This combines a familiar writing format designed for content with the flexibility of Astro's component syntax and architecture.

:::tip
For additional functionality, such as including components and JSX expressions in Markdown, add the [`@astrojs/mdx` integration](/en/guides/integrations-guide/mdx/) to write your Markdown content using [MDX](https://mdxjs.com/).
:::

## Organizing Markdown files

Expand Down Expand Up @@ -213,10 +215,6 @@ export default {

### Modifying frontmatter programmatically

:::note
If you are using [content collections](/en/guides/content-collections/), please see ["Modifying Frontmatter with Remark"](/en/guides/content-collections/#modifying-frontmatter-with-remark).
:::

You can add frontmatter properties to all of your Markdown and MDX files by using a [remark or rehype plugin](#markdown-plugins).

<Steps>
Expand Down Expand Up @@ -440,6 +438,10 @@ const content = marked.parse(markdown);
## Individual Markdown pages
:::tip
[Content collections](/en/guides/content-collections/) and [importing Markdown into `.astro` components](#dynamic-jsx-like-expressions) provide more features for rendering your Markdown and are the recommended way to handle most of your content. However, there may be times when you want the convenience of just adding a file to `src/pages/` and having a simple page automatically created for you.
:::
Astro treats [any supported file inside of the `/src/pages/` directory](/en/basics/astro-pages/#supported-page-files) as a page, including `.md` and other Markdown file types.
Placing a file in this directory, or any sub-directory, will automatically build a page route using the pathname of the file and display the Markdown content rendered to HTML.
Expand All @@ -461,8 +463,6 @@ It probably isn't styled much, but Markdown does support:
- and more!
```
[Content collections](/en/guides/content-collections/) and [importing Markdown into `.astro` components](#dynamic-jsx-like-expressions) provide more features for rendering your Markdown and are the recommended way to handle most of your content. However, there may be times when you want the convenience of just adding a file to `src/pages/` and having a simple page automatically created for you.
### Frontmatter `layout` property
To help with the limited functionality of Markdown pages, Astro provides a special frontmatter `layout` property which is a relative path to an Astro [Markdown layout component](/en/basics/layouts/#markdown-layouts). If your Markdown file is located within `src/pages/`, create a layout component and add it in this layout property to provide a page shell around your Markdown content.
Expand Down Expand Up @@ -495,4 +495,4 @@ const {frontmatter} = Astro.props;

You can also [style your Markdown](/en/guides/styling/#markdown-styling) in your layout component.

<ReadMore>Learn more about [Markdown Layouts](/en/basics/layouts/#markdown-layouts).</ReadMore>
<ReadMore>Learn more about [Markdown Layouts](/en/basics/layouts/#markdown-layouts).</ReadMore>
45 changes: 42 additions & 3 deletions src/content/docs/en/reference/api-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2527,21 +2527,60 @@ Return values are parsed using the [devalue library](https://github.com/Rich-Har

<p>

**Type:** `ZodObject | undefined`
**Type:** `ZodType | undefined`
</p>

The optional `input` property accepts a Zod validator to validate handler inputs at runtime. If the action fails to validate, [a `BAD_REQUEST` error](#actionerror) is returned and the `handler` is not called.

If used with `accept: 'form'`, `input` must use the `z.object()` validator.
If `input` is omitted, the `handler` will receive an input of type `unknown` for JSON requests and type `FormData` for form requests.

Extension functions including `.refine()`, `.transform()`, and `.pipe()` are also supported on this object. The following validators are supported for form data fields:
##### Use with `accept: 'form'`

If your action accepts form inputs, use the `z.object()` validator to automatically parse form data to a typed object. The following validators are supported for form data fields:

- Inputs of type `number` can be validated using `z.number()`
- Inputs of type `checkbox` can be validated using `z.boolean()`
- Inputs of type `file` can be validated using `z.instanceof(File)`
- Multiple inputs of the same `name` can be validated using `z.array(/* validator */)`
- All other inputs can be validated using `z.string()`

Extension functions including `.refine()`, `.transform()`, and `.pipe()` are also supported on the `z.object()` validator.

To apply a union of different validators, use the `z.discriminatedUnion()` wrapper to narrow the type based on a specific form field. This example accepts a form submission to either "create" or "update" a user, using the form field with the name `type` to determine which object to validate against:

```ts
import { defineAction } from 'astro:actions';
import { z } from 'astro:schema';

export const server = {
changeUser: defineAction({
accept: 'form',
input: z.discriminatedUnion('type', [
z.object({
// Matches when the `type` field has the value `create`
type: z.literal('create'),
name: z.string(),
email: z.string().email(),
}),
z.object({
// Matches when the `type` field has the value `update`
type: z.literal('update'),
id: z.number(),
name: z.string(),
email: z.string().email(),
}),
]),
async handler(input) {
if (input.type === 'create') {
// input is { type: 'create', name: string, email: string }
} else {
// input is { type: 'update', id: number, name: string, email: string }
}
},
}),
};
```

### `isInputError()`

<p>
Expand Down
6 changes: 3 additions & 3 deletions src/content/docs/en/reference/configuration-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ import Avatar from '~/components/Avatar.astro';

The outer page will be rendered, either at build time (`hybrid`) or at runtime (`server`) with the island content omitted and a `<script>` tag included in its place.

After the page loads in the browser, the script tag will replace itself with the the contents of the island by making a request.
After the page loads in the browser, the script tag will replace itself with the contents of the island by making a request.

Any Astro component can be given the `server: defer` attribute to delay its rendering. There is no special API and you can write `.astro` code as normal:

Expand Down Expand Up @@ -1724,7 +1724,7 @@ const countries = defineCollection({
export const collections = { countries };
```

For more advanced loading logic, you can define an object loader. This allows incremental updates and conditional loading while also giving full access to the data store. See the API in [the Content Layer API RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0047-content-layer.md#loaders).
For more advanced loading logic, you can define an object loader. This allows incremental updates and conditional loading while also giving full access to the data store. See the API in [the Content Layer API RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0050-content-layer.md#loaders).

#### Migrating an existing content collection to use the Content Layer API

Expand Down Expand Up @@ -1789,5 +1789,5 @@ You can convert an existing content collection with Markdown, MDX, Markdoc, or J

#### Learn more

For a complete overview and the full API reference, see [the Content Layer API RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0047-content-layer.md) and [share your feedback](https://github.com/withastro/roadmap/pull/982).
For a complete overview and the full API reference, see [the Content Layer API RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0050-content-layer.md) and [share your feedback](https://github.com/withastro/roadmap/pull/982).

6 changes: 6 additions & 0 deletions src/content/docs/en/upgrade-astro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: Upgrade Astro
description: Learn how to upgrade Astro
i18nReady: true
banner:
content: Want to upgrade to Astro 5 beta? Read our <a href="https://5-0-0-beta.docs.astro.build/en/guides/upgrade-to/v5/">v5 upgrade guide</a>!
---
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro';
import Version from '~/components/Version.astro';
Expand Down Expand Up @@ -105,6 +107,10 @@ The main Astro documentation pages are always **accurate for the latest released
See the upgrade guides below for an explanation of changes, comparing the new version to the old. The upgrade guides include everything that could require you to change your own code: breaking changes, deprecations, feature removals and replacements as well as updated usage guidance. Each change to Astro includes a "What should I do?" section to help you successfully update your project code.
:::tip
Want to upgrade to the v5 beta? Check out the [v5 upgrade guide in the beta docs](https://5-0-0-beta.docs.astro.build/en/guides/upgrade-to/v5/).
:::
- [Upgrade to v4](/en/guides/upgrade-to/v4/)
- [Upgrade to v3](/en/guides/upgrade-to/v3/)
- [Upgrade to v2](/en/guides/upgrade-to/v2/)
Expand Down
6 changes: 3 additions & 3 deletions src/content/docs/es/guides/deploy/deno.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ npx astro add deno
Si prefieres instalar el adaptador manualmente, sigue los siguientes dos pasos:

<Steps>
1. Añadir [el adaptador `@astrojs/deno`][Deno adapter] a las dependencias de tu proyecto usando tu gestor de paquetes preferido. Si estás usando npm o no estás seguro, ejecuta esto en la terminal:
1. Añadir [el adaptador `@deno/astro-adapter`][Deno adapter] a las dependencias de tu proyecto usando tu gestor de paquetes preferido. Si estás usando npm o no estás seguro, ejecuta esto en la terminal:

```bash
npm install @astrojs/deno
npm install @deno/astro-adapter
```

2. Actualiza el archivo de configuración del proyecto `astro.config.mjs` con los cambios a continuación.

```js ins={3,6-7}
// astro.config.mjs
import { defineConfig } from 'astro/config';
import deno from '@astrojs/deno';
import deno from '@deno/astro-adapter';
export default defineConfig({
output: 'server',
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/es/guides/integrations-guide/deno.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: '@astrojs/deno'
title: '@deno/astro-adapter'
description: El adaptador Deno para Astro
i18nReady: true
---
Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/fr/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ hero:
tagline: "Réalisé par Astro et nos contributeurs open-source."
linkText: "Rejoignez-nous !"
link: /fr/contribute/
banner:
content: Vous souhaitez essayer la bêta d'Astro 5 ? Lisez notre <a href="https://5-0-0-beta.docs.astro.build/fr/guides/upgrade-to/v5/">guide de mise à niveau vers la version 5</a> !
---

import { CardGrid } from '@astrojs/starlight/components'
Expand Down
36 changes: 35 additions & 1 deletion src/content/docs/fr/guides/astro-db.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,12 @@ export default async function () {
## Astro Studio
</StudioHeading>
:::caution
Nous sommes en train de [fermer Astro Studio](https://astro.build/blog/goodbye-astro-studio/). Par conséquent, les utilisateurs ne pourront plus créer de bases de données après le 1er octobre 2024.
Nous vous recommandons [de migrer vos bases de données Studio existantes vers Turso](#migrate-from-astro-studio-to-turso) ou de [connecter Astro DB à n'importe quel serveur libSQL](#libsql).
:::
Astro DB peut se connecter à la plateforme Astro Studio pour ajouter rapidement une base de données hébergée à votre projet. Vous pouvez visualiser, gérer et déployer de nouvelles bases de données hébergées à partir du portail web Astro Studio.
Le [portail web Astro Studio](http://studio.astro.build) vous permet de vous connecter et de gérer vos [bases de données Astro DB](/fr/guides/astro-db/) hébergées à distance via une interface web ou en utilisant des [commandes CLI](/fr/reference/cli-reference/#astro-studio-cli).
Expand Down Expand Up @@ -651,10 +657,38 @@ Pour utiliser une connexion à distance, vous aurez besoin d'un jeton d'applicat
<ReadMore>
Lorsque vous êtes prêt à déployer, consultez notre guide [Déployer avec une connexion Studio](#déployer-avec-une-connexion-studio).
Lorsque vous êtes prêt à déployer, consultez notre guide [Déployer avec une connexion Studio](#déployer-avec-une-connexion-studio).
</ReadMore>
### Migrate from Astro Studio to Turso
<Steps>
1. Dans le [tableau de bord du Studio](https://studio.astro.build/), accédez au projet que vous souhaitez migrer. Dans l'onglet Paramètres, utilisez le bouton « Exporter la base de données » pour télécharger une copie de votre base de données.
2. Suivez les instructions officielles pour [installer le CLI de Turso](https://docs.turso.tech/cli/installation) et [inscrivez-vous ou connectez-vous](https://docs.turso.tech/cli/authentication) à votre compte Turso.
3. Créez une nouvelle base de données en utilisant la copie `.sql` que vous avez téléchargée à l'étape 1.
```sh
turso db create [database-name] --from-dump ./path/to/dump.sql
```
4. Récupérez l'URL de la base de données à l'aide de Turso CLI et utilisez-la comme variable d'environnement `ASTRO_DB_REMOTE_URL`.
```sh
turso db show [database-name]
```
```env
ASTRO_DB_REMOTE_URL=[your-database-url]
```
5. Créez un jeton pour accéder à votre base de données et utilisez-le comme variable d'environnement `ASTRO_DB_APP_TOKEN`.
```sh
turso db tokens create [database-name]
```
```env
ASTRO_DB_APP_TOKEN=[your-app-token]
```
6. Une fois que vous avez confirmé que votre projet se connecte à la nouvelle base de données, vous pouvez supprimer le projet dans Astro Studio en toute sécurité.
</Steps>
## libSQL
<p><Since pkg="@astrojs/db" v="0.14.0" /></p>
Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/fr/guides/content-collections.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: >-
Les collections de contenu permettent d'organiser votre Markdown et de
vérifier les types dans votre frontmatter à l'aide de schémas.
i18nReady: true
banner:
content: Vous souhaitez essayer les nouvelles collections de contenu ? <a href="https://5-0-0-beta.docs.astro.build/fr/guides/upgrade-to/v5/">Passez à la bêta de la v5</a> !
---
import { FileTree } from '@astrojs/starlight/components';
import Since from '~/components/Since.astro'
Expand Down
Loading

0 comments on commit caaba37

Please sign in to comment.