TypeORM markdown documents generator.
- Mermaid ERD diagrams
- Descriptions by JSDoc
- Separations by
@namespace
comments
If you want to see how markdown document being generated, visit below examples:
- Markdown Content: yiy0ung/typeorm-markdown/test/erd.md
- TypeORM Entity Class: yiy0ung/typeorm-markdown/test/entities
npm i -D typeorm-markdown
typeorm-markdown version 1.0.0
Usage: typeorm-markdown [options]
Options:
-v, --version Print the current version
-i, --input <input_regex> Input entity files as a glob pattern
-o, --output <dir_path> Directory path where the erd document will be output (default: "./")
-t, --title <title> Title of the generated erd document (default: "ERD")
--project <project_path> Use --project to explicitly specify the path to a tsconfig.json (default: "tsconfig.json")
-h, --help display help for command
This package is inspired by prisma-markdown, so it has similar usage.
@namespace <name>
- Both ERD and markdown content
- If
@namespace
is not set, it will be classified into theDefault
namespace.
@erd <name>
: Only ERD@describe <name>
: Only markdown content, without ERD@hidden
: Neither ERD nor markdown content
/**
* Both description and ERD on User chapter.
* Also, only ERD on Blog chapter.
*
* @namespace User
* @erd Blog
*/
@Entity()
class User {}
/**
* Only description on User chapter.
*
* @describe User
*/
@Entity()
class UserProfile {}
/**
* Only erd on Blog chapter.
*
* @erd Blog
*/
@Entity()
class BlogPost {}
/**
* Never be shown.
*
* @hidden
*/
@Entity()
class BlogPostHit {}
typeorm-markdown
will generate markdown as specified in the ORM, so any columns that are auto-generated by TypeORM (such as fk columns) cannot be reflected in the markdown documents.
Therefore, it is recommended to write N:M tables and fk columns specifically in the ORM.