https://github.com/vectronic/plantuml-proxy-cli
Simple NodeJS CLI to render local PlantUML files to images using the online PlantUML service.
https://github.com/vectronic/plantuml-proxy-cli
git-hook plantuml
Last synced: 2 months ago
JSON representation
Simple NodeJS CLI to render local PlantUML files to images using the online PlantUML service.
- Host: GitHub
- URL: https://github.com/vectronic/plantuml-proxy-cli
- Owner: vectronic
- License: mit
- Created: 2020-07-01T15:07:22.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-14T18:16:31.000Z (almost 2 years ago)
- Last Synced: 2025-03-11T22:34:52.644Z (2 months ago)
- Topics: git-hook, plantuml
- Language: JavaScript
- Homepage:
- Size: 607 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# plantuml-proxy-cli
[](https://github.com/vectronic/plantuml-proxy-cli/blob/master/LICENSE)
[](https://www.npmjs.com/package/plantuml-proxy-cli)> Simple NodeJS CLI to render local PlantUML files to images using the online PlantUML service.
## Overview
This project provides a simple NodeJS CLI which will look for local PlantUML source files and for each one:- [encode](https://plantuml.com/text-encoding) the file contents
- perform an HTTPS request to the PlantUML [service](https://plantuml.com/server) to render the image
- save the rendered image## Motivation
This mechanism:
- avoids the need to have the required software for PlantUML rendering (Java etc.) installed.
- can easily be used in Git pre-commit hook to ensure rendered images are always up to date.## Alternative
The key driver for this was to ensure I could include rendered UML diagrams could be included in Markdown files
stored in GitHub. A documented
[mechanism to achieve this](https://stackoverflow.com/questions/32203610/how-to-integrate-uml-diagrams-into-gitlab-or-github) does exist:However, as noted in this [excellent post](https://blog.anoff.io/2018-07-31-diagrams-with-plantuml/),
"the downside of this approach is that it will always render the latest commit in your repository even if you browse old versions."## Install
```
npm install plantuml-proxy-cli
```## Usage
```
Render local PlantUML files to images using the online PlantUML service.version 1.0.5
Usage
plantrender --sourceFolder --destFolder [--sourceExt ] [--destFormat ] [--url ]
Command Arguments
--sourceFolder Folder path which contains PlantUML files.
--destFolder Folder path for output of rendered images.
--sourceExt Source PlantUML file extension.
(default: iuml)
--destFormat Output rendered image format.
(valid values: png,txt,svg)
(default: png)
--url URL of the PlantUML render service.
(default: http://www.plantuml.com/plantuml/)Other Arguments
--help Display application help
--version Show version information
-h Display application help
-v Show version information
help Display application help
```## Git Hook
An example Git hook defined in a [Husky](https://github.com/typicode/husky) config file using command
argument defaults would be:```
{
"hooks": {
"pre-commit": "npx plantrender --sourceFolder=uml/source --destFolder=docs/images && git add docs/images/*.png"
}
}
```Otherwise, get funky with the other options:
```
{
"hooks": {
"pre-commit": "npx plantrender --sourceFolder=uml/source --destFolder=docs/images --sourceExt=uml --destFormat=txt && git add docs/images/*.png"
}
}
```## Development
Firstly:
```
npm install
```then:
```
npm run build
```After building, the CLI can be run with:
```
bin/plantrender
```If you get stuck trying running with debug logging:
```
DEBUG='*' bin/plantrender
```## Help etc.
If you have a query or problem, raise an issue in GitHub, or better yet submit a PR!
## License
MIT © Vectronic