puml-for-markdown 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +70 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
- Add a GitHub Action, `danielyaa5/puml-for-markdown@v2`. `update` mode regenerates
|
|
6
|
+
diagrams and commits only the files it changed; `check` mode fails pull requests
|
|
7
|
+
whose diagrams are out of date. Works on Linux, macOS, and Windows runners.
|
|
8
|
+
See [GitHub Action](./README.md#github-action). No CLI changes.
|
|
9
|
+
|
|
10
|
+
## 2.0.1
|
|
11
|
+
|
|
12
|
+
- Correct outdated README statements about Windows support, automated testing,
|
|
13
|
+
the pre-commit hook, and diagram privacy. No runtime behavior changes.
|
|
14
|
+
|
|
3
15
|
## 2.0.0
|
|
4
16
|
|
|
5
17
|
### Migration from version 1
|
package/README.md
CHANGED
|
@@ -80,16 +80,69 @@ Requires **Node.js 22 or newer** (Node.js 24 recommended for development).
|
|
|
80
80
|
|
|
81
81
|
Version 2 raises the minimum Node.js version to 22. Upgrade Node.js before upgrading
|
|
82
82
|
from version 1. Existing dependencies pinned to `1.x` or `^1.2.1` stay on version 1;
|
|
83
|
-
installing `latest`
|
|
83
|
+
installing `latest` selects version 2. See the
|
|
84
84
|
[release notes](./CHANGELOG.md) for the changes.
|
|
85
85
|
|
|
86
86
|
`npm i -g puml-for-markdown`
|
|
87
87
|
|
|
88
|
+
### GitHub Action
|
|
89
|
+
Keep diagrams current without running the CLI yourself. To regenerate and commit them on every push to `main`:
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
# .github/workflows/diagrams.yml
|
|
93
|
+
name: Diagrams
|
|
94
|
+
on:
|
|
95
|
+
push:
|
|
96
|
+
branches: [main]
|
|
97
|
+
permissions:
|
|
98
|
+
contents: write
|
|
99
|
+
jobs:
|
|
100
|
+
diagrams:
|
|
101
|
+
runs-on: ubuntu-latest
|
|
102
|
+
steps:
|
|
103
|
+
- uses: actions/checkout@v4
|
|
104
|
+
- uses: danielyaa5/puml-for-markdown@v2
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
To fail pull requests whose diagrams are out of date instead:
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
name: Diagrams
|
|
111
|
+
on: pull_request
|
|
112
|
+
jobs:
|
|
113
|
+
diagrams:
|
|
114
|
+
runs-on: ubuntu-latest
|
|
115
|
+
steps:
|
|
116
|
+
- uses: actions/checkout@v4
|
|
117
|
+
- uses: danielyaa5/puml-for-markdown@v2
|
|
118
|
+
with:
|
|
119
|
+
mode: check
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
| Input | Default | Description |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| `mode` | `update` | `update` regenerates links and images, then commits and pushes them. `check` regenerates and fails if anything differs from what is committed. |
|
|
125
|
+
| `args` | | Extra CLI options, such as `--local-images -f svg` or `-s https://uml.example.com/plantuml`. Use the options you run locally, or `check` will report differences. |
|
|
126
|
+
| `root-directory` | `.` | Project directory to scan. |
|
|
127
|
+
| `commit` | `true` | In `update` mode, commit and push the changed files. Needs `permissions: contents: write`. |
|
|
128
|
+
| `commit-message` | `Update PlantUML diagrams` | Commit message for `update` mode. |
|
|
129
|
+
| `cache` | `true` | Restore `.puml-cache.json` from earlier runs, and save it in `update` mode, so unchanged diagrams are not rendered or shortened again. |
|
|
130
|
+
|
|
131
|
+
Outputs: `changed` (`true` or `false`), `files` (changed paths, one per line), and `commit` (the pushed SHA).
|
|
132
|
+
|
|
133
|
+
- The action commits only the files the CLI changed, never other changes made earlier in the job, and never `.puml-cache.json`.
|
|
134
|
+
- Commits pushed with the default `GITHUB_TOKEN` do not start new workflow runs, so updates cannot loop.
|
|
135
|
+
- `update` needs a branch checkout. On `pull_request` events use `check`, which also works for forks, or check out `${{ github.head_ref }}` for pull requests from the same repository.
|
|
136
|
+
- `check` contacts the same renderer and shortener as a normal run. TinyURL returns the same link for the same diagram, so a pull request regenerated locally passes. With `-t` and no image export, `check` needs no network.
|
|
137
|
+
- For Polr, pass the key from a secret: `env: POLR_APIKEY: ${{ secrets.POLR_APIKEY }}`.
|
|
138
|
+
- The action uses the runner's Node.js when it is version 22 or newer, and otherwise installs Node.js 22. Linux, macOS, and Windows runners are supported.
|
|
139
|
+
- `@v2` follows the latest 2.x release. Pin a release such as `@2.1.0`, or a commit SHA, to control updates.
|
|
140
|
+
|
|
88
141
|
### Advanced Usage
|
|
89
142
|
Here are some other features supported
|
|
90
143
|
- You can specify the CLI to output the diagram images as png and/or svg see `--output-images` and `--image-formats`.
|
|
91
|
-
For
|
|
92
|
-
|
|
144
|
+
For historical examples of exported images, see [dist_puml/puml](./dist_puml/puml).
|
|
145
|
+
The current pre-commit hook runs the automated tests.
|
|
93
146
|
- You can specify the PUML server used to render the diagrams see `--puml-server-url`
|
|
94
147
|
|
|
95
148
|
### All CLI Options
|
|
@@ -173,18 +226,26 @@ In order to support `!include` we parse puml files and replace any `!include` wi
|
|
|
173
226
|
#### Parsing Markdown
|
|
174
227
|
The markdown files are then parsed for markdown comments. If the comments reference a PlantUML file, a link to the web
|
|
175
228
|
service url will be added next to the comment. Because these links contain the full PlantUML diagram encoding in it,
|
|
176
|
-
|
|
229
|
+
the source can be recovered from the URL. A private repository does not make the
|
|
230
|
+
renderer or shortener private; see [diagram privacy](#reliability-and-operational-notes).
|
|
177
231
|
|
|
178
232
|
### Testing
|
|
179
|
-
|
|
180
|
-
|
|
233
|
+
Run `npm test` to execute the automated CLI regression tests. CI runs on Linux,
|
|
234
|
+
macOS, and Windows with Node.js 22 and 24. The suite covers Markdown updates,
|
|
235
|
+
path handling, ignore rules, includes, image exports, caching, and shortening.
|
|
236
|
+
See [CONTRIBUTING.md](https://github.com/danielyaa5/puml-for-markdown/blob/main/CONTRIBUTING.md)
|
|
237
|
+
for development instructions.
|
|
181
238
|
|
|
182
239
|
### Other Helpful Links
|
|
183
240
|
* [C4-Puml](https://github.com/plantuml-stdlib/C4-PlantUML): A collection of PlantUML diagrams for use in C4, you'll see me using this in my examples
|
|
184
241
|
|
|
185
|
-
###
|
|
186
|
-
|
|
187
|
-
Windows
|
|
242
|
+
### Windows support
|
|
243
|
+
Version 2 fixes the reported Windows path lookup issue
|
|
244
|
+
([#6](https://github.com/danielyaa5/puml-for-markdown/issues/6)). Windows path and
|
|
245
|
+
ignore-rule regressions are covered by automated tests. The version 2 changes
|
|
246
|
+
were also tested on Windows 11 ARM64 with Node.js 24.
|
|
247
|
+
|
|
248
|
+
For remaining limitations, see [reliability and operational notes](#reliability-and-operational-notes).
|
|
188
249
|
|
|
189
250
|
### More Examples
|
|
190
251
|
[](https://tinyurl.com/2amb263t)<!---->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "puml-for-markdown",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "An application to add interactive PUML diagrams to your github markdown files. If running with default arguments, run in project root directory.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|