diff --git a/docs/package.json b/docs/package.json index 9453180..5a0ec0a 100644 --- a/docs/package.json +++ b/docs/package.json @@ -22,6 +22,6 @@ "tailwindcss": "^3.3.6" }, "volta": { - "extends": "../../package.json" + "extends": "../package.json" } } diff --git a/docs/src/content/docs/commands/list.mdx b/docs/src/content/docs/commands/list.mdx index 0238d76..48d393e 100644 --- a/docs/src/content/docs/commands/list.mdx +++ b/docs/src/content/docs/commands/list.mdx @@ -51,7 +51,7 @@ The directory where the migration files are located. The given path should be ab ### `-s`, `--storage ` -The storage to use for where to read the migration history. +The [storage plugin](../../plugins/storage/) 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: diff --git a/docs/src/content/docs/commands/new.mdx b/docs/src/content/docs/commands/new.mdx index dfb8c04..2466901 100644 --- a/docs/src/content/docs/commands/new.mdx +++ b/docs/src/content/docs/commands/new.mdx @@ -7,7 +7,7 @@ import { Tabs, TabItem } from '@astrojs/starlight/components'; 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](../../plugins/generators/), or just be an empty file. ## Usage @@ -69,7 +69,7 @@ The extension to use for the migration file. Unless the [`--template`](#t---temp ### `-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](../../plugins/generators/) 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: diff --git a/docs/src/content/docs/commands/remove.mdx b/docs/src/content/docs/commands/remove.mdx index 5347e43..6c19500 100644 --- a/docs/src/content/docs/commands/remove.mdx +++ b/docs/src/content/docs/commands/remove.mdx @@ -58,7 +58,7 @@ Force removal of the migration history entry even if the migration file does not ### `-s`, `--storage ` -The storage to use for where to read the migration history. +The [storage plugin](../../plugins/storage/) 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: diff --git a/docs/src/content/docs/commands/up.mdx b/docs/src/content/docs/commands/up.mdx index 3320487..7edd241 100644 --- a/docs/src/content/docs/commands/up.mdx +++ b/docs/src/content/docs/commands/up.mdx @@ -57,7 +57,7 @@ The directory where the migration files are located. The given path should be ab ### `-s`, `--storage ` -The storage to use for where to store the migration history. +The [storage plugin](../../plugins/storage/) 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 +73,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)](../../plugins/loaders/) 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: diff --git a/docs/src/content/docs/index.mdx b/docs/src/content/docs/index.mdx index eb44940..d08a601 100644 --- a/docs/src/content/docs/index.mdx +++ b/docs/src/content/docs/index.mdx @@ -29,10 +29,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](plugins/loaders/). 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](plugins/). diff --git a/docs/src/content/docs/intro/quick-start.mdx b/docs/src/content/docs/intro/quick-start.mdx index 8b17463..3f70685 100644 --- a/docs/src/content/docs/intro/quick-start.mdx +++ b/docs/src/content/docs/intro/quick-start.mdx @@ -11,7 +11,7 @@ But for now, this is the way to go. ::: @@ -38,7 +38,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](../plugins/storage/) to store the migration history. Install the plugin you want to use, for example: @@ -84,7 +84,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](/configuration/) for more information. +See [Configuration](../reference/configuration/) for more information. ::: #### Fill the migration file @@ -132,7 +132,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](/configuration). +This will connect to the database using some default values. For ways to configure the connection, see [Configuration](../reference/configuration/). ::: :::caution @@ -141,6 +141,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](../plugins/storage/) +and once for the `--plugin` option as a [Loader Plugin](../plugins/loaders/) 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 4697e1c..dd83f50 100644 --- a/docs/src/content/docs/intro/whats-emigrate.mdx +++ b/docs/src/content/docs/intro/whats-emigrate.mdx @@ -7,11 +7,11 @@ Emigrate is written in [TypeScript](https://www.typescriptlang.org) and is a mig * 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](../../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/). :::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](../../plugins/) 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 d7f9104..4049e68 100644 --- a/docs/src/content/docs/plugins/generators/index.mdx +++ b/docs/src/content/docs/plugins/generators/index.mdx @@ -8,17 +8,17 @@ 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. +Many of the [Loader 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 - - + + :::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`](../../commands/new/#t---template-path) 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 dd2ae37..38b41de 100644 --- a/docs/src/content/docs/plugins/generators/js.mdx +++ b/docs/src/content/docs/plugins/generators/js.mdx @@ -4,7 +4,7 @@ title: "JavaScript Generator" import { Tabs, TabItem } from '@astrojs/starlight/components'; -A [generator plugin](/plugins/generators/) for generating new migration files in JavaScript. +A [generator plugin](../) for generating new migration files in JavaScript. ## Installation @@ -32,4 +32,4 @@ A [generator plugin](/plugins/generators/) for generating new migration files in 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](../../commands/new/)'s documentation. diff --git a/docs/src/content/docs/plugins/generators/mysql.mdx b/docs/src/content/docs/plugins/generators/mysql.mdx index 1ee069a..b923cb7 100644 --- a/docs/src/content/docs/plugins/generators/mysql.mdx +++ b/docs/src/content/docs/plugins/generators/mysql.mdx @@ -4,7 +4,7 @@ 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/). +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/). ## Installation @@ -32,4 +32,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](../../../commands/new/)'s documentation. diff --git a/docs/src/content/docs/plugins/index.mdx b/docs/src/content/docs/plugins/index.mdx index 0b19dad..348551d 100644 --- a/docs/src/content/docs/plugins/index.mdx +++ b/docs/src/content/docs/plugins/index.mdx @@ -11,25 +11,25 @@ Emigrate uses a plugin system to allow you to extend and customize the functiona Emigrate supports different types of plugins that all have different purposes. diff --git a/docs/src/content/docs/plugins/loaders/index.mdx b/docs/src/content/docs/plugins/loaders/index.mdx index 3784f6f..3e1606a 100644 --- a/docs/src/content/docs/plugins/loaders/index.mdx +++ b/docs/src/content/docs/plugins/loaders/index.mdx @@ -6,7 +6,7 @@ import { LinkCard, CardGrid } from '@astrojs/starlight/components'; 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](/loaders/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](default/) for more information. ## Using a loader plugin @@ -16,17 +16,17 @@ 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](../../reference/configuration/#plugins) 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](/plugins/loaders/default/) will be used for all other file types, and doesn't need to be specified. +The [default loader](default/) 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 44dbd23..b5f8946 100644 --- a/docs/src/content/docs/plugins/loaders/mysql.mdx +++ b/docs/src/content/docs/plugins/loaders/mysql.mdx @@ -4,7 +4,7 @@ title: MySQL Loader Plugin import { Tabs, TabItem } from '@astrojs/starlight/components'; -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](/plugins/generators/mysql/) and the [MySQL Storage](/plugins/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](../../generators/mysql/) and the [MySQL Storage](../../storage/mysql/). ## Installation @@ -28,7 +28,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](../../../reference/configuration/). ### Configuration file @@ -76,7 +76,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](../../../reference/configuration) 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 91d3b47..cc26701 100644 --- a/docs/src/content/docs/plugins/reporters/index.mdx +++ b/docs/src/content/docs/plugins/reporters/index.mdx @@ -14,11 +14,11 @@ 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](../../reference/configuration/#reporter) 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 2574f6f..d4ce2b2 100644 --- a/docs/src/content/docs/plugins/reporters/pino.mdx +++ b/docs/src/content/docs/plugins/reporters/pino.mdx @@ -40,7 +40,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](../../../commands/up/#-r---reporter-name) for the `up` command for more information. ### Via configuration file @@ -50,7 +50,7 @@ export default { }; ``` -See [Reporter Configuration](/docs/configuration/#reporter) for more information. +See [Reporter Configuration](../../../reference/configuration/#reporter) 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 124dee2..784acdf 100644 --- a/docs/src/content/docs/plugins/storage/file-system.mdx +++ b/docs/src/content/docs/plugins/storage/file-system.mdx @@ -32,7 +32,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](../../reference/configuration/): ```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 ec318cf..b066ba4 100644 --- a/docs/src/content/docs/plugins/storage/index.mdx +++ b/docs/src/content/docs/plugins/storage/index.mdx @@ -15,13 +15,13 @@ 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](../../reference/configuration/#storage) for more information. ## Available storage plugins - - + + :::note @@ -29,5 +29,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](../../reference/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 5250b84..6dc5e01 100644 --- a/docs/src/content/docs/plugins/storage/mysql.mdx +++ b/docs/src/content/docs/plugins/storage/mysql.mdx @@ -4,7 +4,7 @@ title: MySQL Storage import { Tabs, TabItem } from '@astrojs/starlight/components'; -The MySQL storage plugin uses a MySQL database to store the migration history (*duh*). In the same package you can find the [MySQL Loader](/plugins/loaders/mysql/) and the [MySQL Generator](/plugins/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](../../loaders/mysql/) and the [MySQL Generator](../../generators/mysql/). ## Installation @@ -28,7 +28,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](../../../reference/configuration/). ### Configuration file @@ -83,7 +83,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](../../../reference/configuration) 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 e8753da..d03dcf7 100644 --- a/docs/src/content/docs/reference/configuration.mdx +++ b/docs/src/content/docs/reference/configuration.mdx @@ -47,7 +47,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](../plugins/reporters/) 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 +77,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](../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. ```js title="emigrate.config.js" {2} export default { @@ -86,7 +86,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](../plugins/storage/) section for more information. ::: ### `plugins` @@ -97,8 +97,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](../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. ```js title="emigrate.config.js" {2} export default { @@ -107,7 +107,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](../plugins/storage/mysql) for instance). ::: ### `template`