@nx/plugin:migration

Create a Migration for an Nx Plugin.

Usage

1nx generate migration ... 2

By default, Nx will search for migration in the default collection provisioned in workspace.json.

You can specify the collection explicitly as follows:

1nx g @nx/plugin:migration ... 2

Show what will be generated without writing to disk:

1nx g migration ... --dry-run 2

Examples

Generate a migration exported with the name matching the file name, which will be triggered when migrating to version 1.0.0 or above from a previous version. It results in the migration foo at mylib/src/migrations/foo.ts:

1nx g @nx/plugin:migration mylib/src/migrations/foo.ts -v=1.0.0 2

Generate a migration without providing the file extension, which will be triggered when migrating to version 1.0.0 or above from a previous version. It results in the migration foo at mylib/src/migrations/foo.ts:

1nx g @nx/plugin:migration mylib/src/migrations/foo -v=1.0.0 2

Generate a migration exported with a different name from the file name, which will be triggered when migrating to version 1.0.0 or above from a previous version. It results in the migration custom at mylib/src/migrations/foo.ts:

1nx g @nx/plugin:migration mylib/src/migrations/foo --name=custom -v=1.0.0 2

Options

path

Required
string

The file path to the migration without the file extension. Relative to the current working directory.

packageVersion

vRequired
string

Version to use for the migration.

description

string

Migration description.

name

string

The migration name to export in the plugin migrations collection.

packageJsonUpdates

p
boolean
Default: false

Whether or not to include package.json updates.

skipLintChecks

boolean
Default: false

Do not eslint configuration for plugin json files.