typeorm-markdown
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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

Package Sidebar

Install

npm i typeorm-markdown

Weekly Downloads

444

Version

1.0.1

License

MIT

Unpacked Size

63 kB

Total Files

41

Last publish

Collaborators

  • devjin2194