eugene-manuilov/typeorm-uml

[Question] Generate UML diagram from ts file

adarshaacharya opened this issue · 2 comments

Since typeorm supports .ts file for configuring ORM, is it possible to generate the ER diagram from that file too.. or just json file is supported.

But I just came across typeorm/typeorm#7427 which suggests the entire ormconfig.* system is being modified (perhaps deprecated?) so that may impact how this tool works.

Hi,

typeorm-uml leverages typeorm. Thus, as long as typeorm supports those formats, I believe this library should too.

I am currently using typeorm-uml exclusively using ormconfig.ts files. Hence, it should also work on your end.

The easiest/minimalistic way to set this up is as follows:

  1. Install ts-node if not already leveraged in your project (any alternative to ts-node may also work)
yarn add ts-node --dev
  1. Edit your package.json to create some scripts to easily generate the diagram
"scripts": {
  "typeorm-uml": "node --require ts-node/register node_modules/typeorm-uml/bin/run"
  "database:diagram": "yarn typeorm-uml <yourOptions> <path/to/ormconfig.ts>"
}
  1. Generate your diagram:
yarn database:diagram