1.0.0-alpha.7 • Published 3 years ago

@jujulego/nx-typeorm-plugin v1.0.0-alpha.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

nx-typeorm-plugin

License Version

Plugin for Nx mono-repositories. Helps to use Typeorm inside an app.

Setup

Before using this plugin you must setup Typeorm with an ormconfig.json file at the root of your app.

All you need to use this plugin is to install it:

  • npm install --save-dev @jujulego/nx-typeorm-plugin
  • yarn add --dev @jujulego/nx-typeorm-plugin

Generators

migration

It will generate a new migration.

Use: nx g @jujulego/nx-typeorm-plugin:migration

Options

namedefaultdescription
namerequiredName of the migration to generate
projectnx default projectNx project where the migration should be generated
databasedefaultDatabase connection to use (as in the ormconfig.json)

Executors

db-create

It will create the database inside your database server.

Add the target db-create to your project's config in your workspace.json:

{
  "projects": {
    "example": {
      "targets": {
        "db-create": {
          "executor": "@jujulego/nx-typeorm-plugin:db-create"
        }
      }
    }
  }
}

Warning only postgresql and mysql databases are supported.

Options

namedefaultdescription
databasedefaultDatabase connection to use (as in the ormconfig.json)

db-migrate

It will apply typeorm migrations to a database.

Add the target db-migrate to your project's config in your workspace.json:

{
  "projects": {
    "example": {
      "targets": {
        "db-migrate": {
          "executor": "@jujulego/nx-typeorm-plugin:db-migrate"
        }
      }
    }
  }
}

Options

namedefaultdescription
databasedefaultDatabase connection to use (as in the ormconfig.json)

Running unit tests

Run nx test nx-typeorm-plugin to execute the unit tests via Jest.