@ankhorage/paradox 0.1.16 → 0.1.17
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 +6 -0
- package/README.md +7 -7
- package/dist/analyze/analyze.js +2 -0
- package/dist/analyze/types.d.ts +1 -0
- package/dist/config/types.d.ts +1 -0
- package/dist/model/buildModel.d.ts +1 -0
- package/dist/model/buildModel.js +1 -0
- package/dist/model/types.d.ts +1 -0
- package/dist/render/renderers/markdown.js +8 -6
- package/package.json +1 -1
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
|
|
|
@@ -79,12 +79,12 @@ export default defineParadoxConfig({
|
|
|
79
79
|
<details>
|
|
80
80
|
<summary>Configuration options</summary>
|
|
81
81
|
|
|
82
|
-
| Field | Type
|
|
83
|
-
| ------- |
|
|
84
|
-
| mode | `'safe' \| 'write' \| undefined`
|
|
85
|
-
| docs | `{ title?: string; description?: string; usage?: { entrypoints?: string[]; }; } \| undefined` | no | — | |
|
|
86
|
-
| package | `{ root?: string; entrypoints?: string[]; } \| undefined`
|
|
87
|
-
| output | `{ dir?: string; } \| undefined`
|
|
82
|
+
| Field | Type | Required | Default | Description |
|
|
83
|
+
| ------- | ------------------------------------------------------------------------------------------------------------------- | -------- | ------- | ----------- |
|
|
84
|
+
| mode | `'safe' \| 'write' \| undefined` | no | — | |
|
|
85
|
+
| docs | `{ title?: string; description?: string; usage?: { description?: string; entrypoints?: string[]; }; } \| undefined` | no | — | |
|
|
86
|
+
| package | `{ root?: string; entrypoints?: string[]; } \| undefined` | no | — | |
|
|
87
|
+
| output | `{ dir?: string; } \| undefined` | no | — | |
|
|
88
88
|
|
|
89
89
|
</details>
|
|
90
90
|
|
package/dist/analyze/analyze.js
CHANGED
|
@@ -22,6 +22,7 @@ export async function analyze(config, runtime) {
|
|
|
22
22
|
const badges = await analyzeBadges(root, pkg);
|
|
23
23
|
const project = createProject(root);
|
|
24
24
|
const entrypoints = config.package?.entrypoints ?? ['src/index.ts'];
|
|
25
|
+
const readmeUsageDescription = config.docs?.usage?.description ?? null;
|
|
25
26
|
const usageEntryPoints = config.docs?.usage?.entrypoints ?? [];
|
|
26
27
|
const readmeUsage = await analyzeReadmeUsage({ root, entrypoints: usageEntryPoints });
|
|
27
28
|
const program = createTypeScriptProgram({ root, entrypoints, project });
|
|
@@ -67,6 +68,7 @@ export async function analyze(config, runtime) {
|
|
|
67
68
|
badges,
|
|
68
69
|
sequenceScenarios,
|
|
69
70
|
usage,
|
|
71
|
+
readmeUsageDescription,
|
|
70
72
|
readmeUsage,
|
|
71
73
|
config: configMetadata
|
|
72
74
|
? {
|
package/dist/analyze/types.d.ts
CHANGED
|
@@ -163,6 +163,7 @@ export interface AnalysisResult {
|
|
|
163
163
|
badges: AnalysisBadge[];
|
|
164
164
|
sequenceScenarios: AnalysisSequenceScenario[];
|
|
165
165
|
usage: AnalysisUsage | null;
|
|
166
|
+
readmeUsageDescription: string | null;
|
|
166
167
|
readmeUsage: AnalysisReadmeUsage[];
|
|
167
168
|
config: {
|
|
168
169
|
exportName: string;
|
package/dist/config/types.d.ts
CHANGED
package/dist/model/buildModel.js
CHANGED
package/dist/model/types.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ function renderReadme(model, outputDir, badges, diagrams) {
|
|
|
23
23
|
}
|
|
24
24
|
if (model.description)
|
|
25
25
|
lines.push(model.description, '');
|
|
26
|
-
renderReadmeUsage(lines, model.readmeUsage);
|
|
26
|
+
renderReadmeUsage(lines, model.readmeUsageDescription, model.readmeUsage);
|
|
27
27
|
if (model.usage !== null) {
|
|
28
28
|
lines.push('## Installation', '', '```bash');
|
|
29
29
|
for (const command of model.usage.commands)
|
|
@@ -37,18 +37,20 @@ function renderReadme(model, outputDir, badges, diagrams) {
|
|
|
37
37
|
renderReadmeApi(lines, model);
|
|
38
38
|
return `${lines.join('\n').trimEnd()}\n`;
|
|
39
39
|
}
|
|
40
|
-
function renderReadmeUsage(lines, entries) {
|
|
41
|
-
if (entries.length === 0)
|
|
40
|
+
function renderReadmeUsage(lines, description, entries) {
|
|
41
|
+
if (description === null && entries.length === 0)
|
|
42
42
|
return;
|
|
43
43
|
lines.push('## Usage', '');
|
|
44
|
+
if (description !== null)
|
|
45
|
+
lines.push(description, '');
|
|
44
46
|
for (const entry of entries) {
|
|
45
47
|
if (entry.title !== null)
|
|
46
48
|
lines.push(`### ${entry.title}`, '');
|
|
47
49
|
if (entry.description !== null) {
|
|
48
50
|
const [, ...rest] = entry.description.split('\n');
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
lines.push(
|
|
51
|
+
const entryDescription = rest.join('\n').trim();
|
|
52
|
+
if (entryDescription.length > 0)
|
|
53
|
+
lines.push(entryDescription, '');
|
|
52
54
|
}
|
|
53
55
|
lines.push(`Source: \`${entry.sourcePath}\``, '');
|
|
54
56
|
lines.push(`\`\`\`${entry.language}`);
|