@ankhorage/paradox 0.2.4 → 0.2.5
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
CHANGED
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @ankhorage/paradox
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Deterministic documentation generator for TypeScript packages.
|
|
9
9
|
|
|
@@ -44,11 +44,10 @@ function validateCommentRules(comments) {
|
|
|
44
44
|
*/
|
|
45
45
|
function validateUsageRules(comments) {
|
|
46
46
|
const usageComments = comments.filter((comment) => comment.parsed.isUsage);
|
|
47
|
-
if (usageComments.length === 0)
|
|
47
|
+
if (!DOCUMENTATION_POLICY.readmeUsage.required && usageComments.length === 0)
|
|
48
48
|
return [];
|
|
49
49
|
const findings = usageComments.flatMap((comment) => validateUsageComment(comment));
|
|
50
|
-
const readmeExamples = usageComments.filter((comment) => isBelow(comment.sourcePath, DOCUMENTATION_POLICY.
|
|
51
|
-
comment.parsed.isReadme);
|
|
50
|
+
const readmeExamples = usageComments.filter((comment) => isBelow(comment.sourcePath, DOCUMENTATION_POLICY.readmeUsage.root) && comment.parsed.isReadme);
|
|
52
51
|
if (readmeExamples.length !== DOCUMENTATION_POLICY.readmeUsage.exactCount) {
|
|
53
52
|
findings.push(createDocumentationFinding('documentation.usage.readme.unique', `Expected exactly one @usage + @readme example; found ${readmeExamples.length}.`));
|
|
54
53
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DOCUMENTATION_POLICY } from '@ankhorage/policy/documentation';
|
|
1
2
|
import { slugifyAscii } from '@ankhorage/utility/string';
|
|
2
3
|
/***
|
|
3
4
|
* Renders a deterministic static HTML documentation app.
|
|
@@ -240,10 +241,13 @@ function renderHomeView(model, diagrams, exportsByModule) {
|
|
|
240
241
|
* Renders complete CLI and programmatic usage documentation.
|
|
241
242
|
*/
|
|
242
243
|
function renderUsagePanel(model) {
|
|
244
|
+
if (!DOCUMENTATION_POLICY.readmeUsage.required && model.usageEntries.length === 0)
|
|
245
|
+
return '';
|
|
246
|
+
const { usageEntries } = model;
|
|
243
247
|
return `<section class="panel" data-search="${escapeAttribute([
|
|
244
248
|
'usage',
|
|
245
249
|
model.usage.command,
|
|
246
|
-
...
|
|
250
|
+
...usageEntries.flatMap((entry) => [
|
|
247
251
|
entry.title ?? '',
|
|
248
252
|
entry.description ?? '',
|
|
249
253
|
entry.sourcePath,
|
|
@@ -254,7 +258,7 @@ function renderUsagePanel(model) {
|
|
|
254
258
|
<h3>CLI</h3>
|
|
255
259
|
<pre>${escapeHtml(model.usage.command)}</pre>
|
|
256
260
|
</article>
|
|
257
|
-
${
|
|
261
|
+
${usageEntries.map(renderUsageEntry).join('')}
|
|
258
262
|
</section>`;
|
|
259
263
|
}
|
|
260
264
|
/***
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DOCUMENTATION_POLICY } from '@ankhorage/policy/documentation';
|
|
1
2
|
/***
|
|
2
3
|
* Renders markdown artifacts from the documentation model.
|
|
3
4
|
*/
|
|
@@ -36,8 +37,21 @@ function renderReadme(model, outputDir, badges, diagrams) {
|
|
|
36
37
|
* Renders the canonical CLI-first Usage chapter.
|
|
37
38
|
*/
|
|
38
39
|
function renderUsage(lines, model) {
|
|
40
|
+
if (!DOCUMENTATION_POLICY.readmeUsage.required && model.usageEntries.length === 0)
|
|
41
|
+
return;
|
|
39
42
|
const readmeExample = model.usageEntries.find((entry) => entry.area === 'examples' && entry.isReadme);
|
|
40
43
|
lines.push('## Usage', '');
|
|
44
|
+
for (const section of DOCUMENTATION_POLICY.readmeUsage.sectionOrder) {
|
|
45
|
+
if (section === 'cli') {
|
|
46
|
+
renderCliUsage(lines, model);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
renderProgrammaticUsage(lines, model, readmeExample);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/*** Renders the canonical CLI usage section from package metadata. */
|
|
54
|
+
function renderCliUsage(lines, model) {
|
|
41
55
|
lines.push('### CLI', '');
|
|
42
56
|
lines.push('Ankhorage packages expose their command-line interface through `ankh`. Use `ankh --help` to discover available package commands, or run a package command with `--help` for package-specific usage.', '');
|
|
43
57
|
lines.push('```zsh');
|
|
@@ -46,6 +60,9 @@ function renderUsage(lines, model) {
|
|
|
46
60
|
lines.push(`# Show usage information for ${getPackageDisplayName(model.packageId)}`);
|
|
47
61
|
lines.push(model.usage.command);
|
|
48
62
|
lines.push('```', '');
|
|
63
|
+
}
|
|
64
|
+
/*** Renders the single README-promoted programmatic usage declaration. */
|
|
65
|
+
function renderProgrammaticUsage(lines, model, readmeExample) {
|
|
49
66
|
if (readmeExample === undefined)
|
|
50
67
|
return;
|
|
51
68
|
lines.push(`### ${readmeExample.title ?? 'Programmatic Usage'}`, '');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/paradox",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Deterministic documentation generator for TypeScript packages.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"test:standalone": "bun test tests/cli.e2e.test.ts"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@ankhorage/policy": "^0.
|
|
74
|
+
"@ankhorage/policy": "^0.5.0",
|
|
75
75
|
"@ankhorage/utility": "^1.8.1",
|
|
76
76
|
"ts-morph": "^28.0.0"
|
|
77
77
|
},
|