UML class diagram generator for solidity contracts.
Check out the repository from GitHub and npm install the dependencies
git clone https://github.com/naddison36/solidity-diagram-gen.git
npm install
To see the usage options
$ node sol2uml.js -h
Usage: sol2uml [options] <file or root folder>
Generates UML diagrams from Solidity source code
Options:
-v, --verbose With debugging statements
-o, --output [value] File outputs: svg, png or both (default: "svg")
-h, --help output usage information
To generate the test contracts in this repo
$ node sol2uml.js ./contracts
To generate a SVG diagram of all Solidity files under some root folder. Output will be a diagram.svg
file in the working folder.
$ node sol2uml.js path/to/contracts/root/folder
To generate a SVG diagram of all contracts in a single Solidity file. Output will be a diagram.svg
file in the working folder.
$ node sol2uml.js path/to/contracts/root/folder/solidity/file.sol
To generate SVG and PNG diagrams of all Solidity files under some root folder. Output will be diagram.svg
and diagram.png
files in the working folder.
$ node sol2uml.js -o both path/to/contracts/root/folder
This is a fork of the Richard Ramos's solidity-diagram-gen tool which no longer works as it uses the Solidity parser solidity-parser. This parser can not handle newer Solidity syntax like constructor
.
This version uses the solidity-parser-antlr Solidity parser which is built on top of ANTLR4 grammar.
The diagrams are generated using viz.js which uses Graphviz to render a SVG file.