@ankhorage/paradox 0.2.24 → 0.2.25
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 +1 -25
- package/dist/analyze/analyze.d.ts +0 -1
- package/dist/analyze/analyze.js +0 -5
- package/dist/analyze/types.d.ts +0 -6
- package/dist/cli/standalone.js +1 -1
- package/dist/model/buildModel.d.ts +0 -5
- package/dist/model/buildModel.js +0 -1
- package/dist/model/types.d.ts +0 -6
- package/dist/render/renderers/markdown.js +8 -17
- package/package.json +1 -1
- package/dist/analyze/readmeConfig.d.ts +0 -12
- package/dist/analyze/readmeConfig.js +0 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.25
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 70d72a8: Stop rendering paradox.config.ts as the documented package's README configuration example; configuration docs now come only from the package-owned @config schema.
|
|
8
|
+
|
|
3
9
|
## 0.2.24
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
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
|
|
|
@@ -40,30 +40,6 @@ export const basicConfig = defineParadoxConfig({
|
|
|
40
40
|
|
|
41
41
|
Configures Paradox documentation generation for a package.
|
|
42
42
|
|
|
43
|
-
### Example
|
|
44
|
-
|
|
45
|
-
```ts
|
|
46
|
-
import { defineParadoxConfig } from './src/config/defineParadoxConfig.js';
|
|
47
|
-
|
|
48
|
-
export default defineParadoxConfig({
|
|
49
|
-
mode: 'write',
|
|
50
|
-
|
|
51
|
-
collaborators: true,
|
|
52
|
-
|
|
53
|
-
donation: {
|
|
54
|
-
account: 'ankhorage',
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
package: {
|
|
58
|
-
entrypoints: ['src/index.ts'],
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
output: {
|
|
62
|
-
dir: 'paradox',
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
```
|
|
66
|
-
|
|
67
43
|
<details>
|
|
68
44
|
<summary>Configuration options</summary>
|
|
69
45
|
|
package/dist/analyze/analyze.js
CHANGED
|
@@ -11,7 +11,6 @@ import { validateDocumentationPolicyAsync } from './documentation/validateDocume
|
|
|
11
11
|
import { analyzeExports } from './exports.js';
|
|
12
12
|
import { analyzeModules } from './modules.js';
|
|
13
13
|
import { createProject } from './project.js';
|
|
14
|
-
import { analyzeReadmeConfig } from './readmeConfig.js';
|
|
15
14
|
import { analyzeReadmeUsage, countExampleDirectoriesAsync } from './readmeUsage.js';
|
|
16
15
|
import { createTypeScriptProgram } from './semantic/createTypeScriptProgram.js';
|
|
17
16
|
import { collectTypeMembers, resolveTypeReference } from './semantic/exports.js';
|
|
@@ -41,9 +40,6 @@ export async function analyze(config, runtime) {
|
|
|
41
40
|
const usageEntries = await analyzeReadmeUsage({ root });
|
|
42
41
|
const exampleCount = await countExampleDirectoriesAsync(root);
|
|
43
42
|
const comments = await collectDocumentationCommentsAsync(root);
|
|
44
|
-
const readmeConfig = configMetadata?.isReadme === true
|
|
45
|
-
? await analyzeReadmeConfig({ root, configFilePath: runtime.configFilePath ?? null })
|
|
46
|
-
: null;
|
|
47
43
|
const configMembers = collectConfigMembers(program, exports, configMetadata);
|
|
48
44
|
const graphs = {
|
|
49
45
|
imports: collectImportGraph(program),
|
|
@@ -80,7 +76,6 @@ export async function analyze(config, runtime) {
|
|
|
80
76
|
usageEntries,
|
|
81
77
|
exampleCount,
|
|
82
78
|
findings,
|
|
83
|
-
readmeConfig,
|
|
84
79
|
config: configMetadata === null
|
|
85
80
|
? null
|
|
86
81
|
: {
|
package/dist/analyze/types.d.ts
CHANGED
|
@@ -95,11 +95,6 @@ export interface AnalysisDocumentationFinding {
|
|
|
95
95
|
interface AnalysisDonation {
|
|
96
96
|
account: string;
|
|
97
97
|
}
|
|
98
|
-
interface AnalysisReadmeConfig {
|
|
99
|
-
language: string;
|
|
100
|
-
code: string;
|
|
101
|
-
sourcePath: string;
|
|
102
|
-
}
|
|
103
98
|
export interface AnalysisBadge {
|
|
104
99
|
id: string;
|
|
105
100
|
label: string;
|
|
@@ -184,7 +179,6 @@ export interface AnalysisResult {
|
|
|
184
179
|
usageEntries: AnalysisUsageEntry[];
|
|
185
180
|
exampleCount: number;
|
|
186
181
|
findings: AnalysisDocumentationFinding[];
|
|
187
|
-
readmeConfig: AnalysisReadmeConfig | null;
|
|
188
182
|
config: {
|
|
189
183
|
exportName: string;
|
|
190
184
|
title: string | null;
|
package/dist/cli/standalone.js
CHANGED
|
@@ -22,7 +22,7 @@ async function main() {
|
|
|
22
22
|
const config = await loadParadoxConfig(configFilePath);
|
|
23
23
|
const packageRoot = await resolvePackageRoot(config, configDir);
|
|
24
24
|
const { outputDir, outputRoot } = resolveOutputRoot(config, packageRoot);
|
|
25
|
-
const analysis = await analyze(config, { packageRoot
|
|
25
|
+
const analysis = await analyze(config, { packageRoot });
|
|
26
26
|
assertNoDocumentationErrors(analysis.findings);
|
|
27
27
|
const model = buildModel(analysis);
|
|
28
28
|
const result = render(model, { outputDir });
|
|
@@ -127,11 +127,6 @@ interface BuildModelInput {
|
|
|
127
127
|
sourcePath: string | null;
|
|
128
128
|
line: number | null;
|
|
129
129
|
}[];
|
|
130
|
-
readmeConfig: {
|
|
131
|
-
language: string;
|
|
132
|
-
code: string;
|
|
133
|
-
sourcePath: string;
|
|
134
|
-
} | null;
|
|
135
130
|
config: {
|
|
136
131
|
exportName: string;
|
|
137
132
|
title: string | null;
|
package/dist/model/buildModel.js
CHANGED
|
@@ -17,7 +17,6 @@ export function buildModel(analysis) {
|
|
|
17
17
|
.sort((left, right) => left.sourcePath.localeCompare(right.sourcePath)),
|
|
18
18
|
exampleCount: analysis.exampleCount,
|
|
19
19
|
findings: analysis.findings.map((finding) => ({ ...finding })),
|
|
20
|
-
readmeConfig: analysis.readmeConfig === null ? null : { ...analysis.readmeConfig },
|
|
21
20
|
config: analysis.config === null
|
|
22
21
|
? null
|
|
23
22
|
: {
|
package/dist/model/types.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export interface DocumentationModel {
|
|
|
13
13
|
usageEntries: UsageEntryModel[];
|
|
14
14
|
exampleCount: number;
|
|
15
15
|
findings: DocumentationFindingModel[];
|
|
16
|
-
readmeConfig: ReadmeConfigModel | null;
|
|
17
16
|
config: ConfigModel | null;
|
|
18
17
|
entrypoints: string[];
|
|
19
18
|
modules: ModuleModel[];
|
|
@@ -54,11 +53,6 @@ interface DocumentationFindingModel {
|
|
|
54
53
|
sourcePath: string | null;
|
|
55
54
|
line: number | null;
|
|
56
55
|
}
|
|
57
|
-
interface ReadmeConfigModel {
|
|
58
|
-
language: string;
|
|
59
|
-
code: string;
|
|
60
|
-
sourcePath: string;
|
|
61
|
-
}
|
|
62
56
|
interface ConfigModel {
|
|
63
57
|
exportName: string;
|
|
64
58
|
title: string | null;
|
|
@@ -85,29 +85,20 @@ function getPackageDisplayName(packageId) {
|
|
|
85
85
|
return packageId.split('/').pop() ?? packageId;
|
|
86
86
|
}
|
|
87
87
|
/***
|
|
88
|
-
* Renders the
|
|
88
|
+
* Renders the package-owned Configuration chapter from the canonical tagged schema.
|
|
89
89
|
*/
|
|
90
90
|
function renderConfiguration(lines, model) {
|
|
91
91
|
const config = model.config?.isReadme ? model.config : null;
|
|
92
|
-
|
|
93
|
-
if (config === null && example === null)
|
|
92
|
+
if (config === null)
|
|
94
93
|
return;
|
|
95
94
|
lines.push('## Configuration', '');
|
|
96
|
-
if (config !== null) {
|
|
97
|
-
|
|
98
|
-
lines.push(`### ${config.title}`, '');
|
|
99
|
-
}
|
|
100
|
-
if (config.description !== null)
|
|
101
|
-
lines.push(config.description, '');
|
|
102
|
-
renderReferences(lines, config);
|
|
103
|
-
}
|
|
104
|
-
if (example !== null) {
|
|
105
|
-
lines.push('### Example', '');
|
|
106
|
-
lines.push('```' + example.language);
|
|
107
|
-
lines.push(example.code);
|
|
108
|
-
lines.push('```', '');
|
|
95
|
+
if (config.title !== null && config.title !== 'Configuration') {
|
|
96
|
+
lines.push(`### ${config.title}`, '');
|
|
109
97
|
}
|
|
110
|
-
if (config
|
|
98
|
+
if (config.description !== null)
|
|
99
|
+
lines.push(config.description, '');
|
|
100
|
+
renderReferences(lines, config);
|
|
101
|
+
if (config.members.length === 0)
|
|
111
102
|
return;
|
|
112
103
|
lines.push('<details>');
|
|
113
104
|
lines.push('<summary>Configuration options</summary>', '');
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface AnalysisReadmeConfig {
|
|
2
|
-
language: string;
|
|
3
|
-
code: string;
|
|
4
|
-
sourcePath: string;
|
|
5
|
-
}
|
|
6
|
-
/***
|
|
7
|
-
* Collects the concrete Paradox configuration instance as a README configuration example.
|
|
8
|
-
*/
|
|
9
|
-
export declare function analyzeReadmeConfig(options: {
|
|
10
|
-
root: string;
|
|
11
|
-
configFilePath: string | null;
|
|
12
|
-
}): Promise<AnalysisReadmeConfig | null>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { extname, relative } from 'node:path';
|
|
3
|
-
import { toPortablePath } from '@ankhorage/utility/node/path';
|
|
4
|
-
/***
|
|
5
|
-
* Collects the concrete Paradox configuration instance as a README configuration example.
|
|
6
|
-
*/
|
|
7
|
-
export async function analyzeReadmeConfig(options) {
|
|
8
|
-
if (options.configFilePath === null)
|
|
9
|
-
return null;
|
|
10
|
-
const source = await readFile(options.configFilePath, 'utf-8');
|
|
11
|
-
const sourcePath = toPortablePath(relative(options.root, options.configFilePath));
|
|
12
|
-
return {
|
|
13
|
-
language: getLanguage(sourcePath),
|
|
14
|
-
code: source.trim(),
|
|
15
|
-
sourcePath,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
/***
|
|
19
|
-
* Returns the Markdown fence language for a configuration source path.
|
|
20
|
-
*/
|
|
21
|
-
function getLanguage(sourcePath) {
|
|
22
|
-
const extension = extname(sourcePath).toLowerCase();
|
|
23
|
-
if (extension === '.ts')
|
|
24
|
-
return 'ts';
|
|
25
|
-
if (extension === '.js' || extension === '.mjs' || extension === '.cjs')
|
|
26
|
-
return 'js';
|
|
27
|
-
return '';
|
|
28
|
-
}
|