From ca6834d95fab4ae79fd153b5009a0958960ffab8 Mon Sep 17 00:00:00 2001 From: Joakim Carlstein Date: Tue, 19 Dec 2023 09:57:23 +0100 Subject: [PATCH] refactor: use a custom Link component to be able to use absolute URLs everywhere ...that supports any `base` property --- docs/astro.config.mjs | 2 +- docs/src/components/Link.astro | 11 +++++++++++ docs/src/content/docs/commands/list.mdx | 5 +++-- docs/src/content/docs/commands/new.mdx | 11 ++++++----- docs/src/content/docs/commands/remove.mdx | 5 +++-- docs/src/content/docs/commands/up.mdx | 7 ++++--- docs/src/content/docs/index.mdx | 5 +++-- docs/src/content/docs/intro/quick-start.mdx | 11 ++++++----- docs/src/content/docs/intro/whats-emigrate.mdx | 12 +++++++----- docs/src/content/docs/plugins/generators/index.mdx | 5 +++-- docs/src/content/docs/plugins/generators/js.mdx | 5 +++-- docs/src/content/docs/plugins/generators/mysql.mdx | 5 +++-- docs/src/content/docs/plugins/loaders/index.mdx | 7 ++++--- docs/src/content/docs/plugins/loaders/mysql.mdx | 7 ++++--- docs/src/content/docs/plugins/reporters/index.mdx | 3 ++- docs/src/content/docs/plugins/reporters/pino.mdx | 5 +++-- .../content/docs/plugins/storage/file-system.mdx | 3 ++- docs/src/content/docs/plugins/storage/index.mdx | 5 +++-- docs/src/content/docs/plugins/storage/mysql.mdx | 7 ++++--- docs/src/content/docs/reference/configuration.mdx | 13 +++++++------ docs/tsconfig.json | 8 +++++++- 21 files changed, 89 insertions(+), 53 deletions(-) create mode 100644 docs/src/components/Link.astro diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index e60204a..00937fe 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -7,7 +7,7 @@ const base = process.env.ASTRO_BASE || ''; // https://astro.build/config export default defineConfig({ - site: process.env.ASTRO_SITE, + site: process.env.ASTRO_SITE ?? 'http://localhost:4321', base: base || undefined, integrations: [ starlight({ diff --git a/docs/src/components/Link.astro b/docs/src/components/Link.astro new file mode 100644 index 0000000..8c45d97 --- /dev/null +++ b/docs/src/components/Link.astro @@ -0,0 +1,11 @@ +--- +interface Props { + href: string; +} + +const base = import.meta.env.BASE_URL === '/' || !import.meta.env.BASE_URL ? '' : import.meta.env.BASE_URL; +const site = import.meta.env.SITE ?? ''; +const { href } = Astro.props; +--- + + diff --git a/docs/src/content/docs/commands/list.mdx b/docs/src/content/docs/commands/list.mdx index 48d393e..e433a34 100644 --- a/docs/src/content/docs/commands/list.mdx +++ b/docs/src/content/docs/commands/list.mdx @@ -4,6 +4,7 @@ description: "List migrations and their status." --- import { Tabs, TabItem } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; The `list` command is used to list _all_ migrations, i.e. both already run migrations and migrations that haven't been run yet. @@ -51,7 +52,7 @@ The directory where the migration files are located. The given path should be ab ### `-s`, `--storage ` -The [storage plugin](../../plugins/storage/) to use, which is responsible for where to store the migration history. +The storage plugin to use, which is responsible for where to store the migration history. The name can be either a path to a module or a package name. For package names Emigrate will automatically prefix the given name with these prefixes in order: @@ -67,7 +68,7 @@ In case you have both a `emigrate-storage-somedb` and a `somedb` package install ### `-r`, `--reporter ` -The reporter to use for listing the migrations. +The reporter to use for listing the migrations. The name can be either a path to a module or a package name. For package names Emigrate will automatically prefix the given name with these prefixes in order: diff --git a/docs/src/content/docs/commands/new.mdx b/docs/src/content/docs/commands/new.mdx index 2466901..517bbbb 100644 --- a/docs/src/content/docs/commands/new.mdx +++ b/docs/src/content/docs/commands/new.mdx @@ -4,10 +4,11 @@ description: "Create new migration." --- import { Tabs, TabItem } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; The `new` command is used to create a new migration file in the given directory. -The migration file can be based on a template, generated by a [generator plugin](../../plugins/generators/), or just be an empty file. +The migration file can be based on a template, generated by a generator plugin, or just be an empty file. ## Usage @@ -61,15 +62,15 @@ The directory where the migration files are located. The given path should be ab The template file to use for generating the migration file. The given path should be absolute or relative to the current working directory. -The template can contain a `{{name}}` placeholder which will be replaced with the migration name provided to the command. The generated file will have the same extension as the template file, unless the [`--extension`](#e---extension-ext) option is used. +The template can contain a `{{name}}` placeholder which will be replaced with the migration name provided to the command. The generated file will have the same extension as the template file, unless the [`--extension`](#-e---extension-ext) option is used. ### `-e`, `--extension ` -The extension to use for the migration file. Unless the [`--template`](#t---template-path) option is also specified the file will be empty. +The extension to use for the migration file. Unless the [`--template`](#-t---template-path) option is also specified the file will be empty. ### `-p`, `--plugin ` -The [generator plugin](../../plugins/generators/) to use. The generator plugin is responsible for generating the migration filename and its contents. +The generator plugin to use. The generator plugin is responsible for generating the migration filename and its contents. The name can be either a path to a module or a package name. For package names Emigrate will automatically prefix the given name with these prefixes in order: @@ -84,7 +85,7 @@ In case you have both a `emigrate-plugin-someplugin` and a `someplugin` package ### `-r`, `--reporter ` -The reporter to use for listing the migrations. +The reporter to use for listing the migrations. The name can be either a path to a module or a package name. For package names Emigrate will automatically prefix the given name with these prefixes in order: diff --git a/docs/src/content/docs/commands/remove.mdx b/docs/src/content/docs/commands/remove.mdx index 6c19500..be029eb 100644 --- a/docs/src/content/docs/commands/remove.mdx +++ b/docs/src/content/docs/commands/remove.mdx @@ -4,6 +4,7 @@ description: "Remove a migration from the history." --- import { Tabs, TabItem } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; The `remove` command is used to remove a migration from the history. This is useful if you want to retry a migration that has failed. @@ -58,7 +59,7 @@ Force removal of the migration history entry even if the migration file does not ### `-s`, `--storage ` -The [storage plugin](../../plugins/storage/) to use, which is responsible for where to store the migration history. +The storage plugin to use, which is responsible for where to store the migration history. The name can be either a path to a module or a package name. For package names Emigrate will automatically prefix the given name with these prefixes in order: @@ -74,7 +75,7 @@ In case you have both a `emigrate-storage-somedb` and a `somedb` package install ### `-r`, `--reporter ` -The reporter to use for listing the migrations. +The reporter to use for listing the migrations. The name can be either a path to a module or a package name. For package names Emigrate will automatically prefix the given name with these prefixes in order: diff --git a/docs/src/content/docs/commands/up.mdx b/docs/src/content/docs/commands/up.mdx index 7edd241..b45effb 100644 --- a/docs/src/content/docs/commands/up.mdx +++ b/docs/src/content/docs/commands/up.mdx @@ -4,6 +4,7 @@ description: "Run migrations" --- import { Tabs, TabItem } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; The `up` command is used to either list or run all pending migrations, i.e. migrations that haven't been run yet. @@ -57,7 +58,7 @@ The directory where the migration files are located. The given path should be ab ### `-s`, `--storage ` -The [storage plugin](../../plugins/storage/) to use, which is responsible for where to store the migration history. +The storage plugin to use, which is responsible for where to store the migration history. The name can be either a path to a module or a package name. For package names Emigrate will automatically prefix the given name with these prefixes in order: @@ -73,7 +74,7 @@ In case you have both a `emigrate-storage-somedb` and a `somedb` package install ### `-p`, `--plugin ` -The [loader plugin(s)](../../plugins/loaders/) to use. Can be specified multiple times to use multiple plugins. +The loader plugin(s) to use. Can be specified multiple times to use multiple plugins. The name can be either a path to a module or a package name. For package names Emigrate will automatically prefix the given name with these prefixes in order: @@ -88,7 +89,7 @@ In case you have both a `emigrate-plugin-someplugin` and a `someplugin` package ### `-r`, `--reporter ` -The reporter to use for reporting the migration progress. +The reporter to use for reporting the migration progress. The name can be either a path to a module or a package name. For package names Emigrate will automatically prefix the given name with these prefixes in order: diff --git a/docs/src/content/docs/index.mdx b/docs/src/content/docs/index.mdx index 060db67..2ac0dae 100644 --- a/docs/src/content/docs/index.mdx +++ b/docs/src/content/docs/index.mdx @@ -17,6 +17,7 @@ hero: --- import { Card, CardGrid } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; ## Key features @@ -29,10 +30,10 @@ import { Card, CardGrid } from '@astrojs/starlight/components'; Migrate many databases from one repository or many repositories to one database. There's no need to synchronize deployments. - Write your migration files using the [language of your choice](plugins/loaders/). + Write your migration files using the language of your choice. And mix and match them as you need. E.g. `SQL` for database schema changes, and `JavaScript` for data transformation. - Emigrate is designed to be flexible and customizable to suite any environment and setup using its [plugin system](plugins/). + Emigrate is designed to be flexible and customizable to suite any environment and setup using its plugin system. diff --git a/docs/src/content/docs/intro/quick-start.mdx b/docs/src/content/docs/intro/quick-start.mdx index 12eac1f..5017867 100644 --- a/docs/src/content/docs/intro/quick-start.mdx +++ b/docs/src/content/docs/intro/quick-start.mdx @@ -4,6 +4,7 @@ description: Get going with Emigrate quickly --- import { Tabs, TabItem, LinkCard } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; :::note The following guide will be even simpler soon with the release of a initialization command. @@ -38,7 +39,7 @@ But for now, this is the way to go. ### Pick a storage plugin -Emigrate uses a [storage plugin](../../plugins/storage/) to store the migration history. +Emigrate uses a storage plugin to store the migration history. Install the plugin you want to use, for example: @@ -84,7 +85,7 @@ Otherwise the file would have the `.js` extension by default. :::tip[Did you know?] You can avoid typing `--plugin mysql` by configuring Emigrate using an `emigrate.config.js` file. -See [Configuration](../../reference/configuration/) for more information. +See Configuration for more information. ::: #### Fill the migration file @@ -132,7 +133,7 @@ npx emigrate up --storage mysql --plugin mysql --dry ``` :::note -This will connect to the database using some default values. For ways to configure the connection, see [Configuration](../../reference/configuration/). +This will connect to the database using some default values. For ways to configure the connection, see Configuration. ::: :::caution @@ -141,6 +142,6 @@ Be sure to configure the connection correctly and use the `--dry` flag to test y ::: :::tip[Did you know?] -In the example above the `@emigrate/mysql` plugin is used twice, once for the `--storage` option as a [Storage Plugin](../../plugins/storage/) -and once for the `--plugin` option as a [Loader Plugin](../../plugins/loaders/) to be able to read `.sql` files. +In the example above the `@emigrate/mysql` plugin is used twice, once for the `--storage` option as a Storage Plugin +and once for the `--plugin` option as a Loader Plugin to be able to read `.sql` files. ::: diff --git a/docs/src/content/docs/intro/whats-emigrate.mdx b/docs/src/content/docs/intro/whats-emigrate.mdx index dd83f50..c152272 100644 --- a/docs/src/content/docs/intro/whats-emigrate.mdx +++ b/docs/src/content/docs/intro/whats-emigrate.mdx @@ -3,15 +3,17 @@ title: What's Emigrate? description: An introduction to Emigrate, the modern database agnostic migration tool. --- +import Link from '@components/Link.astro'; + Emigrate is written in [TypeScript](https://www.typescriptlang.org) and is a migration tool for any database or data. * It's database agnostic - you can use it with any database, or even with non-database data. * It's the successor of [klei-migrate](https://github.com/klei/migrate) and is designed to be compatible with [Immigration](https://github.com/blakeembrey/node-immigration) and many of its storage plugins, as well as [Migrate](https://github.com/tj/node-migrate). -* It supports migration files written using [CommonJS or ES Modules out of the box](../../plugins/loaders/default/), with any of the following extensions: `.js`, `.cjs` or `.mjs`, and supports [async functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function), [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) or using the [NodeJS Callback Pattern](https://nodejs.org/en/learn/asynchronous-work/javascript-asynchronous-programming-and-callbacks#handling-errors-in-callbacks). -* Other languages can be used by using a [Loader Plugin](../../plugins/loaders/). -* The migration history can be stored anywhere using a [Storage Plugin](../../plugins/storage/). -* The output can be customized using [Reporters](../../plugins/reporters/). +* It supports migration files written using CommonJS or ES Modules out of the box, with any of the following extensions: `.js`, `.cjs` or `.mjs`, and supports [async functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function), [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) or using the [NodeJS Callback Pattern](https://nodejs.org/en/learn/asynchronous-work/javascript-asynchronous-programming-and-callbacks#handling-errors-in-callbacks). +* Other languages can be used by using a Loader Plugin. +* The migration history can be stored anywhere using a Storage Plugin. +* The output can be customized using Reporters. :::tip[Did you know?] -Thanks to [the plugin system](../../plugins/) you can even write migrations in plain SQL! So no need for Java-based tools like Liquibase or Flyway. +Thanks to the plugin system you can even write migrations in plain SQL! So no need for Java-based tools like Liquibase or Flyway. ::: diff --git a/docs/src/content/docs/plugins/generators/index.mdx b/docs/src/content/docs/plugins/generators/index.mdx index 4049e68..3d737ca 100644 --- a/docs/src/content/docs/plugins/generators/index.mdx +++ b/docs/src/content/docs/plugins/generators/index.mdx @@ -3,12 +3,13 @@ title: "Generator Plugins" --- import { LinkCard, CardGrid } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; 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](../loaders/) usually include a generator plugin as well. +Many of the Loader Plugins 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. ::: @@ -20,5 +21,5 @@ The generator is responsible for generating migration files in a specific format :::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. +Instead of having to install a generator plugin, you can also use the much simpler `--template` option to specify a custom template file for new migrations. ::: diff --git a/docs/src/content/docs/plugins/generators/js.mdx b/docs/src/content/docs/plugins/generators/js.mdx index 38b41de..f344fa5 100644 --- a/docs/src/content/docs/plugins/generators/js.mdx +++ b/docs/src/content/docs/plugins/generators/js.mdx @@ -3,8 +3,9 @@ title: "JavaScript Generator" --- import { Tabs, TabItem } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; -A [generator plugin](../) for generating new migration files in JavaScript. +A generator plugin for generating new migration files in JavaScript. ## Installation @@ -32,4 +33,4 @@ A [generator plugin](../) for generating new migration files in JavaScript. emigrate new --plugin generate-js create some fancy table ``` -For more information see [the `new` command](../../commands/new/)'s documentation. +For more information see the `new` command's documentation. diff --git a/docs/src/content/docs/plugins/generators/mysql.mdx b/docs/src/content/docs/plugins/generators/mysql.mdx index b923cb7..582b16f 100644 --- a/docs/src/content/docs/plugins/generators/mysql.mdx +++ b/docs/src/content/docs/plugins/generators/mysql.mdx @@ -3,8 +3,9 @@ title: "MySQL Generator" --- import { Tabs, TabItem } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; -The MySQL generator creates new migration files with the `.sql` extension. In the same package you can find the [MySQL Loader](../../loaders/mysql/) and the [MySQL Storage](../../storage/mysql/). +The MySQL generator creates new migration files with the `.sql` extension. In the same package you can find the MySQL Loader and the MySQL Storage. ## Installation @@ -32,4 +33,4 @@ The MySQL generator creates new migration files with the `.sql` extension. In th emigrate new --plugin mysql create some fancy table ``` -For more information see [the `new` command](../../../commands/new/)'s documentation. +For more information see the `new` command's documentation. diff --git a/docs/src/content/docs/plugins/loaders/index.mdx b/docs/src/content/docs/plugins/loaders/index.mdx index 3e1606a..288393a 100644 --- a/docs/src/content/docs/plugins/loaders/index.mdx +++ b/docs/src/content/docs/plugins/loaders/index.mdx @@ -3,10 +3,11 @@ title: Loader Plugins --- import { LinkCard, CardGrid } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; Loader plugins are used to transform any file type into a JavaScript function that will be called when the migration file is executed. -Out of the box, Emigrate supports the following file extensions: `.js`, `.cjs` and `.mjs`. And both CommonJS and ES Modules are supported. See the [Default Loader](default/) for more information. +Out of the box, Emigrate supports the following file extensions: `.js`, `.cjs` and `.mjs`. And both CommonJS and ES Modules are supported. See the Default Loader for more information. ## Using a loader plugin @@ -16,12 +17,12 @@ You can specify a loader plugin via the `--plugin` (or `-p` for short) option: npx emigrate up --plugin mysql ``` -Or set it up in your configuration file, see [Plugin configuration](../../reference/configuration/#plugins) for more information. +Or set it up in your configuration file, see Plugin configuration for more information. :::tip[Did you know?] You can specify multiple loader plugins at the same time, which is needed when you mix file types in your migrations folder. For example, you can use the `mysql` loader for `.sql` files and the `typescript` loader for `.ts` files. -The [default loader](default/) will be used for all other file types, and doesn't need to be specified. +The default loader will be used for all other file types, and doesn't need to be specified. ::: ## Available Loader Plugins diff --git a/docs/src/content/docs/plugins/loaders/mysql.mdx b/docs/src/content/docs/plugins/loaders/mysql.mdx index b5f8946..a2baab8 100644 --- a/docs/src/content/docs/plugins/loaders/mysql.mdx +++ b/docs/src/content/docs/plugins/loaders/mysql.mdx @@ -3,8 +3,9 @@ title: MySQL Loader Plugin --- import { Tabs, TabItem } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; -The MySQL loader plugin transforms `.sql` files into JavaScript functions that Emigrate can use to execute the migrations. In the same package you can find the [MySQL Generator](../../generators/mysql/) and the [MySQL Storage](../../storage/mysql/). +The MySQL loader plugin transforms `.sql` files into JavaScript functions that Emigrate can use to execute the migrations. In the same package you can find the MySQL Generator and the MySQL Storage. ## Installation @@ -28,7 +29,7 @@ The MySQL loader plugin transforms `.sql` files into JavaScript functions that E ## Configuration -The MySQL loader plugin can be configured either using environment variables or by configuring the plugin directly in the [`emigrate.config.js` file](../../../reference/configuration/). +The MySQL loader plugin can be configured either using environment variables or by configuring the plugin directly in the `emigrate.config.js` file. ### Configuration file @@ -76,7 +77,7 @@ The environment variables are used when the plugin is used using the `--plugin` npx emigrate list --plugin mysql ``` -Or when specifying the plugin in the [`emigrate.config.js` file](../../../reference/configuration) as a string: +Or when specifying the plugin in the `emigrate.config.js` file as a string: ```js title="emigrate.config.js" {2} export default { diff --git a/docs/src/content/docs/plugins/reporters/index.mdx b/docs/src/content/docs/plugins/reporters/index.mdx index cc26701..be0a1ec 100644 --- a/docs/src/content/docs/plugins/reporters/index.mdx +++ b/docs/src/content/docs/plugins/reporters/index.mdx @@ -3,6 +3,7 @@ title: Reporters --- import { LinkCard, CardGrid } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; A reporter is a plugin that's responsible for printing the migration progress and results to the console. @@ -14,7 +15,7 @@ You can specify a reporter via the `--reporter` (or `-r` for short) option: npx emigrate list --reporter pino ``` -Or set it up in your configuration file, see [Reporter configuration](../../reference/configuration/#reporter) for more information. +Or set it up in your configuration file, see Reporter configuration for more information. ## Available Reporters diff --git a/docs/src/content/docs/plugins/reporters/pino.mdx b/docs/src/content/docs/plugins/reporters/pino.mdx index d4ce2b2..37d7be6 100644 --- a/docs/src/content/docs/plugins/reporters/pino.mdx +++ b/docs/src/content/docs/plugins/reporters/pino.mdx @@ -3,6 +3,7 @@ title: Pino Reporter --- import { Tabs, TabItem } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; Emigrate's reporter that uses [Pino](https://getpino.io/#/) as the logger. @@ -40,7 +41,7 @@ The `@emigrate/reporter-` prefix is optional when using this reporter. emigrate --reporter pino ``` -See for instance the [Reporter Option](../../../commands/up/#-r---reporter-name) for the `up` command for more information. +See for instance the Reporter Option for the `up` command for more information. ### Via configuration file @@ -50,7 +51,7 @@ export default { }; ``` -See [Reporter Configuration](../../../reference/configuration/#reporter) for more information. +See Reporter Configuration for more information. ## Example output diff --git a/docs/src/content/docs/plugins/storage/file-system.mdx b/docs/src/content/docs/plugins/storage/file-system.mdx index 784acdf..94a5cad 100644 --- a/docs/src/content/docs/plugins/storage/file-system.mdx +++ b/docs/src/content/docs/plugins/storage/file-system.mdx @@ -3,6 +3,7 @@ title: File System Storage --- import { Tabs, TabItem } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; The File System Storage is a storage driver that stores the migration history in a `.json` file on the local file system. @@ -32,7 +33,7 @@ This is suitable for simple setups, but for more advanced setups for instance wh ## Configuration -The File System Storage can be configured easily in your [`emigrate.config.js` file](../../reference/configuration/): +The File System Storage can be configured easily in your `emigrate.config.js` file: ```js {1,4-6} import storageFs from '@emigrate/storage-fs'; diff --git a/docs/src/content/docs/plugins/storage/index.mdx b/docs/src/content/docs/plugins/storage/index.mdx index b066ba4..4188084 100644 --- a/docs/src/content/docs/plugins/storage/index.mdx +++ b/docs/src/content/docs/plugins/storage/index.mdx @@ -3,6 +3,7 @@ title: Storage Plugins --- import { LinkCard, CardGrid } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; Storage plugins are used for storing and reading the migration history state. Usually you'll want to store the migration history in the same database as the one which your migration files are targeting. @@ -15,7 +16,7 @@ You can specify a storage plugin via the `--storage` (or `-s` for short) option: npx emigrate list --storage mysql ``` -Or set it up in your configuration file, see [Storage configuration](../../reference/configuration/#storage) for more information. +Or set it up in your configuration file, see Storage configuration for more information. ## Available storage plugins @@ -29,5 +30,5 @@ More storage plugins are coming soon! ::: :::tip[Is your database missing?] -Writing a storage plugin is easy! Check out the [Storage Plugin API](../../reference/storage-plugin-api/) for more information. +Writing a storage plugin is easy! Check out the Storage Plugin API for more information. ::: diff --git a/docs/src/content/docs/plugins/storage/mysql.mdx b/docs/src/content/docs/plugins/storage/mysql.mdx index 6dc5e01..8e36a5a 100644 --- a/docs/src/content/docs/plugins/storage/mysql.mdx +++ b/docs/src/content/docs/plugins/storage/mysql.mdx @@ -3,8 +3,9 @@ title: MySQL Storage --- import { Tabs, TabItem } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; -The MySQL storage plugin uses a MySQL database to store the migration history (*duh*). In the same package you can find the [MySQL Loader](../../loaders/mysql/) and the [MySQL Generator](../../generators/mysql/). +The MySQL storage plugin uses a MySQL database to store the migration history (*duh*). In the same package you can find the MySQL Loader and the MySQL Generator. ## Installation @@ -28,7 +29,7 @@ The MySQL storage plugin uses a MySQL database to store the migration history (* ## Configuration -The MySQL storage can be configured either using environment variables or by configuring the plugin directly in the [`emigrate.config.js` file](../../../reference/configuration/). +The MySQL storage can be configured either using environment variables or by configuring the plugin directly in the `emigrate.config.js` file. ### Configuration file @@ -83,7 +84,7 @@ The environment variables are used when the storage plugin is used using the `-- npx emigrate list --storage mysql ``` -Or when specifying the storage in the [`emigrate.config.js` file](../../../reference/configuration) as a string: +Or when specifying the storage in the `emigrate.config.js` file as a string: ```js title="emigrate.config.js" {2} export default { diff --git a/docs/src/content/docs/reference/configuration.mdx b/docs/src/content/docs/reference/configuration.mdx index d03dcf7..5294cc3 100644 --- a/docs/src/content/docs/reference/configuration.mdx +++ b/docs/src/content/docs/reference/configuration.mdx @@ -6,6 +6,7 @@ sidebar: --- import { Tabs, TabItem } from '@astrojs/starlight/components'; +import Link from '@components/Link.astro'; Emigrate can be configured using a configuration file, and it uses [Cosmiconfig](https://github.com/cosmiconfig/cosmiconfig) under the hood so you can use a variety of formats and locations for your configuration file. @@ -47,7 +48,7 @@ Set the directory where your migrations are located, relative to the project roo **type:** `string | EmigrateReporter | Promise | (() => Promise)` **default:** `"default"` - the default reporter -Set the reporter to use for the different commands. Specifying a [reporter](../plugins/reporters/) is most useful in a CI or production environment where you either ship logs or want to have a machine-readable format. +Set the reporter to use for the different commands. Specifying a reporter is most useful in a CI or production environment where you either ship logs or want to have a machine-readable format. ```js title="emigrate.config.js" {2} export default { @@ -77,7 +78,7 @@ The default reporter automatically detects if the current environment is an inte **type:** `string | EmigrateStorage | Promise | (() => Promise)` -Set the [storage plugin](../plugins/storage/) to use for storing and reading the migration history. This option is required by all Emigrate commands except `new` which doesn't use it. +Set the storage plugin to use for storing and reading the migration history. This option is required by all Emigrate commands except `new` which doesn't use it. ```js title="emigrate.config.js" {2} export default { @@ -86,7 +87,7 @@ export default { ``` :::note -Each storage plugin can have its own configuration options, see the corresponding [Storage Plugin](../plugins/storage/) section for more information. +Each storage plugin can have its own configuration options, see the corresponding Storage Plugin section for more information. ::: ### `plugins` @@ -97,8 +98,8 @@ Set the plugins to use for the different commands. There are different types of In short: -* [Loader Plugins](../plugins/loaders/) - are used for transforming non-JavaScript files into JavaScript files that can be executed by Node.js. These are only used by the `up` command. -* [Generator Plugins](../plugins/generators/) - are used for generating new migration files. These are only used by the `new` command. +* Loader Plugins - are used for transforming non-JavaScript files into JavaScript files that can be executed by Node.js. These are only used by the `up` command. +* Generator Plugins - are used for generating new migration files. These are only used by the `new` command. ```js title="emigrate.config.js" {2} export default { @@ -107,7 +108,7 @@ export default { ``` :::tip[Did you know?] -The same package can expose multiple plugins, so you can specify the plugin only once and it can be used as both a loader and a generator (and storage, in the case of [MySQL](../plugins/storage/mysql) for instance). +The same package can expose multiple plugins, so you can specify the plugin only once and it can be used as both a loader and a generator (and storage, in the case of MySQL for instance). ::: ### `template` diff --git a/docs/tsconfig.json b/docs/tsconfig.json index fbc2f5f..a128757 100644 --- a/docs/tsconfig.json +++ b/docs/tsconfig.json @@ -1,3 +1,9 @@ { - "extends": "astro/tsconfigs/strictest" + "extends": "astro/tsconfigs/strictest", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@components/*": ["src/components/*"] + } + } }