@proscom/typeorm-uml

Generates UML diagrams for TypeORM projects

Usage no npm install needed!

<script type="module">
  import proscomTypeormUml from 'https://cdn.skypack.dev/@proscom/typeorm-uml';
</script>

README

@proscom/typeorm-uml 1.2.0

A command line tool to generate UML diagrams for Typeorm projects. It uses plantuml to render diagrams and outputs an URL to a diagram. It can also output diagram definition in the plnatuml syntax.

This is a fork of https://github.com/eugene-manuilov/typeorm-uml with couple of additional features:

  • output plantuml syntax instead of the url
  • output entity/property or table/column names or both
  • use regexp in include/exclude

Installation

Install this command as a development dependency to your project:

npm i -D @proscom/typeorm-uml
// or
yarn add --dev @proscom/typeorm-uml

Usage

Add a new script to your package.json to be able to run it:

{
    "name": "myproject",
    "scripts": {
        "db:diagram": "typeorm-uml ormconfig.json"
    }
}

Then run npm run db:diagram and you will receive an URL to an image with your diagram. You can use this URL to add to your README file or you can download the image and add it to your repository.

Synopsis

USAGE
  $ typeorm-uml [CONFIGNAME]

ARGUMENTS
  CONFIGNAME  [default: ormconfig.json] Path to the Typeorm config file.

OPTIONS
  -c, --connection=connection  [default: default] The connection name.
  -d, --download=download      The filename where to download the diagram.
  -e, --exclude=exclude        Comma-separated list of entities to exclude from the diagram.
  -f, --format=png|svg|txt     [default: png] The diagram file format.
  -i, --include=include        Comma-separated list of entities to include into the diagram.
  --uml                        Outputs plantuml syntax instead of the url
  --monochrome                 Whether or not to use monochrome colors.

Typescript

If you use .ts entities in your Typeorm config, then run this command with ts-node like this:

ts-node ./node_modules/@proscom/typeorm-uml/bin/run ormconfig.json

Example

typeorm/typescript-example

typeorm-uml --format=svg --monochrome

typeorm/typescript-example

Contribute

Want to help or have a suggestion? Open a new ticket and we can discuss it or submit a pull request.

License

MIT