[Question] Generate UML diagram from ts file
adarshaacharya opened this issue · 2 comments
adarshaacharya commented
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.
ianstokesrees-gamma commented
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.
julien-sugg commented
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:
- Install
ts-node
if not already leveraged in your project (any alternative tots-node
may also work)
yarn add ts-node --dev
- 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>"
}
- Generate your diagram:
yarn database:diagram