@datalackey/update-markdown-uml 1.1.9 → 1.1.11
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/dist/cli/UmlRunConfig.d.ts +5 -0
- package/dist/cli/UmlRunConfig.js +1 -0
- package/dist/cli/descriptor.d.ts +3 -0
- package/dist/cli/descriptor.js +22 -0
- package/dist/cli/parseUmlOptions.d.ts +3 -0
- package/dist/cli/parseUmlOptions.js +13 -0
- package/dist/cli/validateUmlConfig.d.ts +2 -0
- package/dist/cli/validateUmlConfig.js +22 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { parseUmlOptions } from "./parseUmlOptions.js";
|
|
2
|
+
import { validateUmlConfig } from "./validateUmlConfig.js";
|
|
3
|
+
export const descriptor = {
|
|
4
|
+
name: "update-markdown-uml",
|
|
5
|
+
description: "Generate and validate UML class and package diagrams for TypeScript source trees",
|
|
6
|
+
options: [
|
|
7
|
+
{
|
|
8
|
+
flag: "--exclude-packages",
|
|
9
|
+
description: "Leaf package directory names to exclude from diagram generation",
|
|
10
|
+
requiresValue: true,
|
|
11
|
+
valueName: "pkg1,pkg2,..."
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
flag: "--source",
|
|
15
|
+
description: "Override source root discovery (default: src/)",
|
|
16
|
+
requiresValue: true,
|
|
17
|
+
valueName: "path"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
parseOptions: parseUmlOptions,
|
|
21
|
+
validate: validateUmlConfig
|
|
22
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function parseUmlOptions(standard, passthrough) {
|
|
2
|
+
const rawExclude = passthrough.get("--exclude-packages");
|
|
3
|
+
const excludePackages = typeof rawExclude === "string" && rawExclude.length > 0
|
|
4
|
+
? rawExclude.split(",").map((s) => s.trim()).filter((s) => s.length > 0)
|
|
5
|
+
: [];
|
|
6
|
+
const rawSource = passthrough.get("--source");
|
|
7
|
+
const sourceRoot = typeof rawSource === "string" ? rawSource : undefined;
|
|
8
|
+
return {
|
|
9
|
+
...standard,
|
|
10
|
+
excludePackages: excludePackages,
|
|
11
|
+
sourceRoot: sourceRoot
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
const DEFAULT_SOURCE_ROOT = "src";
|
|
4
|
+
export function validateUmlConfig(config) {
|
|
5
|
+
if (config.excludePackages.length === 0) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const resolvedSourceRoot = path.resolve(process.cwd(), config.sourceRoot ?? DEFAULT_SOURCE_ROOT);
|
|
9
|
+
if (!fs.existsSync(resolvedSourceRoot)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const leafDirs = new Set(fs.readdirSync(resolvedSourceRoot, { withFileTypes: true })
|
|
13
|
+
.filter((entry) => entry.isDirectory())
|
|
14
|
+
.map((entry) => entry.name));
|
|
15
|
+
for (const excluded of config.excludePackages) {
|
|
16
|
+
if (!leafDirs.has(excluded)) {
|
|
17
|
+
if (!config.quiet) {
|
|
18
|
+
console.log(`Warning: excluded package "${excluded}" not found under source root "${resolvedSourceRoot}"`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalackey/update-markdown-uml",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"description": "Generates and validates UML class and package diagrams for TypeScript source trees, injecting them into Markdown documentation files",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|