docs(generators): add some documentation for generator plugins

This commit is contained in:
Joakim Carlstein 2023-12-18 15:17:12 +01:00 committed by Joakim Carlstein
parent 13e370362a
commit 5911331889
3 changed files with 94 additions and 0 deletions

View file

@ -0,0 +1,24 @@
---
title: "Generator Plugins"
---
import { LinkCard, CardGrid } from '@astrojs/starlight/components';
A generator plugin is a plugin that generates new migration files.
They are responsible for both generating the new file's name and its contents.
:::tip[Did you know?]
Many of the [Loader Plugins](/plugins/loaders/) usually include a generator plugin as well.
The generator is responsible for generating migration files in a specific format and the loader is responsible for loading the same format.
:::
## Available Generator Plugins
<CardGrid>
<LinkCard title="JavaScript generator" href="/plugins/generators/js/" description="A generator that generates .js migration files (using ESM and default export)" />
<LinkCard title="MySQL generator" href="/plugins/generators/mysql/" description="A generator that generates .sql migration files" />
</CardGrid>
:::note
Instead of having to install a generator plugin, you can also use the much simpler [`--template`](/commands/new/#t---template-path) option to specify a custom template file for new migrations.
:::

View file

@ -0,0 +1,35 @@
---
title: "JavaScript Generator"
---
import { Tabs, TabItem } from '@astrojs/starlight/components';
A [generator plugin](/plugins/generators/) for generating new migration files in JavaScript.
## Installation
<Tabs>
<TabItem label="npm">
```bash
npm install @emigrate/plugin-generate-js
```
</TabItem>
<TabItem label="pnpm">
```bash
pnpm add @emigrate/plugin-generate-js
```
</TabItem>
<TabItem label="yarn">
```bash
yarn add @emigrate/plugin-generate-js
```
</TabItem>
</Tabs>
## Usage
```bash
emigrate new --plugin generate-js create some fancy table
```
For more information see [the `new` command](/commands/new/)'s documentation.

View file

@ -0,0 +1,35 @@
---
title: "MySQL Generator"
---
import { Tabs, TabItem } from '@astrojs/starlight/components';
The MySQL generator creates new migration files with the `.sql` extension. In the same package you can find the [MySQL Loader](/plugins/loaders/mysql/) and the [MySQL Storage](/plugins/storage/mysql/).
## Installation
<Tabs>
<TabItem label="npm">
```bash
npm install @emigrate/mysql
```
</TabItem>
<TabItem label="pnpm">
```bash
pnpm add @emigrate/mysql
```
</TabItem>
<TabItem label="yarn">
```bash
yarn add @emigrate/mysql
```
</TabItem>
</Tabs>
## Usage
```bash
emigrate new --plugin mysql create some fancy table
```
For more information see [the `new` command](/commands/new/)'s documentation.