@ankhorage/paradox 0.2.23 → 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 CHANGED
@@ -1,5 +1,17 @@
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
+
9
+ ## 0.2.24
10
+
11
+ ### Patch Changes
12
+
13
+ - 9c1050d: Update Ankhorage dependencies: `@ankhorage/utility`.
14
+
3
15
  ## 0.2.23
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @ankhorage/paradox
5
5
 
6
- ![license: MIT](./paradox/badges/license.svg) ![npm: v0.2.23](./paradox/badges/npm.svg) ![runtime: bun](./paradox/badges/runtime.svg) ![typescript: strict](./paradox/badges/typescript.svg) ![eslint: checked](./paradox/badges/eslint.svg) ![prettier: checked](./paradox/badges/prettier.svg) ![build: checked](./paradox/badges/build.svg) ![tests: checked](./paradox/badges/tests.svg) ![paradox: canonical](./paradox/badges/docs.svg)
6
+ ![license: MIT](./paradox/badges/license.svg) ![npm: v0.2.25](./paradox/badges/npm.svg) ![runtime: bun](./paradox/badges/runtime.svg) ![typescript: strict](./paradox/badges/typescript.svg) ![eslint: checked](./paradox/badges/eslint.svg) ![prettier: checked](./paradox/badges/prettier.svg) ![build: checked](./paradox/badges/build.svg) ![tests: checked](./paradox/badges/tests.svg) ![paradox: canonical](./paradox/badges/docs.svg)
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
 
@@ -5,5 +5,4 @@ import type { AnalysisResult } from './types.js';
5
5
  */
6
6
  export declare function analyze(config: ParadoxConfig, runtime: {
7
7
  packageRoot: string;
8
- configFilePath?: string;
9
8
  }): Promise<AnalysisResult>;
@@ -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
  : {
@@ -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;
@@ -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, configFilePath });
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;
@@ -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
  : {
@@ -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 canonical Configuration chapter from the tagged schema plus concrete config instance.
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
- const example = model.readmeConfig;
93
- if (config === null && example === null)
92
+ if (config === null)
94
93
  return;
95
94
  lines.push('## Configuration', '');
96
- if (config !== null) {
97
- if (config.title !== null && config.title !== 'Configuration') {
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 === null || config.members.length === 0)
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/paradox",
3
- "version": "0.2.23",
3
+ "version": "0.2.25",
4
4
  "description": "Deterministic documentation generator for TypeScript packages.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -72,7 +72,7 @@
72
72
  },
73
73
  "dependencies": {
74
74
  "@ankhorage/policy": "^0.6.0",
75
- "@ankhorage/utility": "^1.9.54",
75
+ "@ankhorage/utility": "^1.9.61",
76
76
  "ts-morph": "^28.0.0"
77
77
  },
78
78
  "devDependencies": {
@@ -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
- }