postapl-mermaid-graph

0.1.0 • Public • Published

PostAPL Mermaid Graph

NPM Version

PostAPL Mermaid Graph is a PostAPL plugin that creates graph data for Mermaid Live Editor of the Component tree of your APL or of the AST.

Input / Output

The plugin is of type Reporter that does not transform the APL in any way.

Examples

You can find example reports here.

Usage

Step 1: Install plugin:

npm install --save-dev postapl postapl-mermaid-graph

Step 2: Use:

'use strict'

const { postapl } = require('postapl');
const graph = require('postapl-mermaid-graph');
const fs = require('fs');

fs.readFile('src/screen.json', (err, apl) => {
  postapl([graph({ componentGraphPath: 'report/screen.componentTree.txt' })])
    .process(apl, { from: 'src/screen.json', to: 'dest/screen.json' })
    .then(result => {
      fs.writeFile(result.opts.to, result.apl, () => true)
    })
});

Options

  • componentGraphPath - When set, the path to write the graph file for Components. When set to ##messages:myComponentKey no file is written but the data can be found in result.messages as:

    {
      type: 'output',
      id: 'myComponentKey',
      plugin: 'postapl-mermaid-graph',
      value: string // the graph data
    }
  • treeGraphPath - When set, the path to write the graph file for AST. When set to ##messages:myTreeKey no file is written but the data can be found in result.messages as:

    {
      type: 'output',
      id: 'myTreeKey',
      plugin: 'postapl-mermaid-graph',
      value: string // the graph data
    }

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i postapl-mermaid-graph

    Weekly Downloads

    4

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    10.2 kB

    Total Files

    9

    Last publish

    Collaborators

    • rmtuckerphx