Skip to content

Transforms TS AST to MMD format for generating graphs using mermaid-js

Notifications You must be signed in to change notification settings

stechy1/ast-to-mmd

Repository files navigation

AST-to-MMD

Simple utility to transform your TS code to MermaidJS syntax for flowcharts.

New file *.mmd is generated next to each TS file which fulfilled condition.

Usage

Install utility as dev dependency: npm install --dev @stechy1/ast-to-mmd. Run it with npx @stechy1/ast-to-mmd.

Options

  • -p, --path <path>: Defines path where to find (one) source file,
  • -d, --directory <path>: Defines path to directory where to find source files,
  • -ts, --tsConfig <tsConfigPath>: Defines path to project ts-config.json file,
  • -g, --idGenerator <type>: Defines type of ID generator ('uuid' | 'incremental'), default='incremental',
  • -f, --fileFilter <fileFilterPath>: Defines path to file with filter rules.

Supported constructs

Filter conditions

JSON conditions

Supported logical condition constructs:

  • and: all conditions must be fulfilled
  • or: some of the conditions must be fulfilled
  • not: negate condition Supported functional condition constructs:
  • contains: tested file path must contain defined string
  • endsWith: tested file path must ends with defined string

Example of simmple JSON conditions:

{
  "and": [
    {
      "endsWith": "handler.ts",
      "contains": "event",
      "not": {
        "contains": "entity"
      }
    }
  ]
}

About

Transforms TS AST to MMD format for generating graphs using mermaid-js

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published