Development
Run the playground, the tests and a build of @excalidraw/mermaid-to-excalidraw.
Setup
git clone git@github.com:excalidraw/mermaid-to-excalidraw.git
cd mermaid-to-excalidraw
yarnPlayground
yarn startStarts the playground at localhost:3418. It converts the definition you type and every test case, and shows Pele's drawing next to the Excalidraw result. It's deployed to mermaid-to-excalidraw.vercel.app.
Tests
| Command | What it does |
|---|---|
yarn test | Unit tests (Vitest, in tests/) |
yarn test:code | ESLint |
yarn test:visual | Visual tests (Playwright): a snapshot of each feature test case |
yarn test:visual:update | Records new visual snapshots after an intended change |
yarn test:visual:dev | The visual test page at localhost:3419, usually handier than the playground for comparing a case |
Test cases
Test cases are Mermaid files in testcases/, named <type>-<name>.mmd, where the type is flowchart, sequence, class, erd, state, swimlane or unsupported:
testcases/features/has one syntax feature per file. The playground lists them, the visual tests snapshot each one (named after the file), and the unit tests parse them. Add a case as a new file: renaming one renames its snapshot.testcases/examples/has whole diagrams that models wrote for the prompts inprompts.md, with the model and prompt in%%comments at the top. They're for checking the layout and performance of real-world diagrams.
Build
yarn buildCompiles the library to dist/.
Branches
master is v3. v2 is maintained on release/2.x. Changes are listed in CHANGELOG.md.
Last updated on