@wrhs/diagrams
Utility to generate consistent Mermaid diagrams for Warehouse.ai modules.
Install
npm install @wrhs/diagrams --save-dev
Usage
The easiest way to use this tool is by adding an npm
command to the
consuming module's package.json
"scripts": {
"diagrams": "wrhs-diagrams --source=./docs/diagrams --target=./docs --theme=forest"
...
},
This command can then be used from the consuming module by running
npm run diagrams
API
The tool uses puppeteer with Mermaid's API to generate svg's
from
the .mmd
diagram definitions. canihaz
will install Puppeteer
the first time this tool is used. It only has a single command,
but it supports the following flags.
- --source: Relative path to directory with
.mmd
source files,
defaults to ./diagrams
. - --target: Relative path to directory to store
.png
output files,
defaults to ./assets
. - --file: Relative path to source files
--file one.mmd --file two.mmd
. - --theme: Theme to be used for diagram styling, defaults to
forest
.
Note: If you need to assert the HTML used in Puppeteer to generate the
chart set DEBUG=true
to have the script output both an .png
and .html
file.
Test
npm test