1.0.1 • Published 6 months ago

typeorm-markdown v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

TypeORM Markdown

typeorm_markdown_thumbnail

GitHub license npm version Downloads

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:

Set up

npm i -D typeorm-markdown

Command Line Interface

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

Comment Tags

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 the Default 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 {}

Notice

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.

License

MIT

1.0.1

6 months ago

1.0.0

7 months ago

0.1.5

7 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.1.2

7 months ago

0.1.1

7 months ago

0.1.0

7 months ago