@textmode/docs 0.2.2 → 0.4.0
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/LICENSE +121 -0
- package/README.md +50 -12
- package/index.d.ts +1 -0
- package/package.json +8 -8
- package/src/internal/config.js +7 -0
- package/src/internal/operations.js +24 -18
- package/src/internal/typedoc-plugins/api-frontmatter/README.md +3 -3
- package/src/internal/typedoc-plugins/api-frontmatter/frontmatter.js +2 -1
- package/src/internal/typedoc-runner.js +4 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Creative Commons Legal Code
|
|
2
|
+
|
|
3
|
+
CC0 1.0 Universal
|
|
4
|
+
|
|
5
|
+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
6
|
+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
7
|
+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
8
|
+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
9
|
+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
10
|
+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
11
|
+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
12
|
+
HEREUNDER.
|
|
13
|
+
|
|
14
|
+
Statement of Purpose
|
|
15
|
+
|
|
16
|
+
The laws of most jurisdictions throughout the world automatically confer
|
|
17
|
+
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
18
|
+
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
19
|
+
authorship and/or a database (each, a "Work").
|
|
20
|
+
|
|
21
|
+
Certain owners wish to permanently relinquish those rights to a Work for
|
|
22
|
+
the purpose of contributing to a commons of creative, cultural and
|
|
23
|
+
scientific works ("Commons") that the public can reliably and without fear
|
|
24
|
+
of later claims of infringement build upon, modify, incorporate in other
|
|
25
|
+
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
26
|
+
and for any purposes, including without limitation commercial purposes.
|
|
27
|
+
These owners may contribute to the Commons to promote the ideal of a free
|
|
28
|
+
culture and the further production of creative, cultural and scientific
|
|
29
|
+
works, or to gain reputation or greater distribution for their Work in
|
|
30
|
+
part through the use and efforts of others.
|
|
31
|
+
|
|
32
|
+
For these and/or other purposes and motivations, and without any
|
|
33
|
+
expectation of additional consideration or compensation, the person
|
|
34
|
+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
35
|
+
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
36
|
+
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
37
|
+
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
38
|
+
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
39
|
+
|
|
40
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
41
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
|
42
|
+
Related Rights"). Copyright and Related Rights include, but are not
|
|
43
|
+
limited to, the following:
|
|
44
|
+
|
|
45
|
+
i. the right to reproduce, adapt, distribute, perform, display,
|
|
46
|
+
communicate, and translate a Work;
|
|
47
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
48
|
+
iii. publicity and privacy rights pertaining to a person's image or
|
|
49
|
+
likeness depicted in a Work;
|
|
50
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
|
51
|
+
subject to the limitations in paragraph 4(a), below;
|
|
52
|
+
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
53
|
+
in a Work;
|
|
54
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
55
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
|
56
|
+
protection of databases, and under any national implementation
|
|
57
|
+
thereof, including any amended or successor version of such
|
|
58
|
+
directive); and
|
|
59
|
+
vii. other similar, equivalent or corresponding rights throughout the
|
|
60
|
+
world based on applicable law or treaty, and any national
|
|
61
|
+
implementations thereof.
|
|
62
|
+
|
|
63
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
64
|
+
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
65
|
+
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
66
|
+
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
67
|
+
of action, whether now known or unknown (including existing as well as
|
|
68
|
+
future claims and causes of action), in the Work (i) in all territories
|
|
69
|
+
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
70
|
+
treaty (including future time extensions), (iii) in any current or future
|
|
71
|
+
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
72
|
+
including without limitation commercial, advertising or promotional
|
|
73
|
+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
74
|
+
member of the public at large and to the detriment of Affirmer's heirs and
|
|
75
|
+
successors, fully intending that such Waiver shall not be subject to
|
|
76
|
+
revocation, rescission, cancellation, termination, or any other legal or
|
|
77
|
+
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
78
|
+
as contemplated by Affirmer's express Statement of Purpose.
|
|
79
|
+
|
|
80
|
+
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
81
|
+
be judged legally invalid or ineffective under applicable law, then the
|
|
82
|
+
Waiver shall be preserved to the maximum extent permitted taking into
|
|
83
|
+
account Affirmer's express Statement of Purpose. In addition, to the
|
|
84
|
+
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
85
|
+
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
86
|
+
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
87
|
+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
88
|
+
maximum duration provided by applicable law or treaty (including future
|
|
89
|
+
time extensions), (iii) in any current or future medium and for any number
|
|
90
|
+
of copies, and (iv) for any purpose whatsoever, including without
|
|
91
|
+
limitation commercial, advertising or promotional purposes (the
|
|
92
|
+
"License"). The License shall be deemed effective as of the date CC0 was
|
|
93
|
+
applied by Affirmer to the Work. Should any part of the License for any
|
|
94
|
+
reason be judged legally invalid or ineffective under applicable law, such
|
|
95
|
+
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
96
|
+
of the License, and in such case Affirmer hereby affirms that he or she
|
|
97
|
+
will not (i) exercise any of his or her remaining Copyright and Related
|
|
98
|
+
Rights in the Work or (ii) assert any associated claims and causes of
|
|
99
|
+
action with respect to the Work, in either case contrary to Affirmer's
|
|
100
|
+
express Statement of Purpose.
|
|
101
|
+
|
|
102
|
+
4. Limitations and Disclaimers.
|
|
103
|
+
|
|
104
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
105
|
+
surrendered, licensed or otherwise affected by this document.
|
|
106
|
+
b. Affirmer offers the Work as-is and makes no representations or
|
|
107
|
+
warranties of any kind concerning the Work, express, implied,
|
|
108
|
+
statutory or otherwise, including without limitation warranties of
|
|
109
|
+
title, merchantability, fitness for a particular purpose, non
|
|
110
|
+
infringement, or the absence of latent or other defects, accuracy, or
|
|
111
|
+
the present or absence of errors, whether or not discoverable, all to
|
|
112
|
+
the greatest extent permissible under applicable law.
|
|
113
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
114
|
+
that may apply to the Work or any use thereof, including without
|
|
115
|
+
limitation any person's Copyright and Related Rights in the Work.
|
|
116
|
+
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
117
|
+
consents, permissions or other rights required for any use of the
|
|
118
|
+
Work.
|
|
119
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
120
|
+
party to this document and has no duty or obligation with respect to
|
|
121
|
+
this CC0 or use of the Work.
|
package/README.md
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
# @textmode/docs
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
libraries. The package owns the TypeDoc stack, Markdown plugins, public API
|
|
5
|
-
checks, example validation, and API-link maintenance behind one command.
|
|
3
|
+
<div align="center">
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
<img alt="@textmode/docs — doc textmode with typedoc" src=".github/assets/readme-og.png" />
|
|
8
6
|
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
- `@textmode/docs` owns TypeDoc and its plugins, shared defaults, rendering,
|
|
12
|
-
validation, link editing, and command behavior.
|
|
7
|
+
| [](https://developer.mozilla.org/en-US/docs/Web/JavaScript) [](https://typedoc.org/) | [](https://code.textmode.art/) [](https://discord.gg/sjrw8QXNks) | [](https://ko-fi.com/V7V8JG2FY) [](https://github.com/sponsors/humanbydefinition) |
|
|
8
|
+
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
13
9
|
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
`@textmode/docs` provides shared documentation generation and validation for public [`textmode.js`](https://github.com/humanbydefinition/textmode.js) libraries. The package owns the [TypeDoc](https://typedoc.org/) stack, Markdown plugins, public API checks, example validation, and API-link maintenance behind one command.
|
|
13
|
+
|
|
14
|
+
Use it to generate, validate, and maintain API documentation for every library without maintaining a per-repository TypeDoc setup.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **One-command documentation** - Generate, check, watch, and maintain API links through `textmode-docs`.
|
|
19
|
+
- **Shared TypeDoc stack** - TypeDoc plus plugins with registered defaults and project-owned policy via `textmode.docs.config.mjs`.
|
|
20
|
+
- **Public API validation** - Requires docstrings and examples on every public API reflection.
|
|
21
|
+
- **Example policy checks** - Gallery, manifest, and sketch checks with hardcoded source bases rejected.
|
|
22
|
+
- **API-link maintenance** - Idempotent JSDoc link insertion across configured source roots.
|
|
23
|
+
- **Strict by default** - Warnings become errors; exit codes distinguish success, validation failure, and invocation failure.
|
|
16
24
|
|
|
17
25
|
## Installation
|
|
18
26
|
|
|
@@ -20,7 +28,7 @@ tooling config, invoke TypeDoc directly, or import package internals.
|
|
|
20
28
|
npm install --save-dev @textmode/docs typescript
|
|
21
29
|
```
|
|
22
30
|
|
|
23
|
-
##
|
|
31
|
+
## Usage
|
|
24
32
|
|
|
25
33
|
Conventional projects need no configuration file. Create
|
|
26
34
|
`textmode.docs.config.mjs` at the project root only for policy that differs
|
|
@@ -76,7 +84,22 @@ without examples.
|
|
|
76
84
|
The `typedoc` object can override registered TypeDoc options except
|
|
77
85
|
`entryPoints`, `out`, `tsconfig`, `plugin`, `router`, `emit`, `watch`,
|
|
78
86
|
`treatWarningsAsErrors`, `treatValidationWarningsAsErrors`, and options whose
|
|
79
|
-
names begin with `textmode`.
|
|
87
|
+
names begin with `textmode`. TypeDoc options are configured here, not through
|
|
88
|
+
`package.json#typedocOptions`.
|
|
89
|
+
|
|
90
|
+
`editLink: true` enables the "Edit this page on GitHub" link on generated
|
|
91
|
+
API pages for the package. The default (`false`) omits the link because API
|
|
92
|
+
reference is generated and should not be edited in place via the docs site.
|
|
93
|
+
|
|
94
|
+
## Related packages
|
|
95
|
+
|
|
96
|
+
`@textmode/docs` works with the following textmode-tooling packages:
|
|
97
|
+
|
|
98
|
+
| Package | Relationship |
|
|
99
|
+
| --------------------------------------------- | ------------------------------------- |
|
|
100
|
+
| [`@textmode/tsconfig`](../tsconfig/README.md) | TypeDoc reads the consumer `tsconfig` |
|
|
101
|
+
|
|
102
|
+
## Configuration
|
|
80
103
|
|
|
81
104
|
### Defaults
|
|
82
105
|
|
|
@@ -90,6 +113,7 @@ names begin with `textmode`.
|
|
|
90
113
|
| Hosted API URL | `https://code.textmode.art/api/<package-name>` |
|
|
91
114
|
| Member pages | Methods, properties, and accessors |
|
|
92
115
|
| Self-link stripping | `full` |
|
|
116
|
+
| Edit link on API pages | Disabled (opt in per package with `editLink: true`) |
|
|
93
117
|
| Sorting | Kind, instance-first, alphabetical (except documents) |
|
|
94
118
|
| API-link kinds | All supported reflection kinds |
|
|
95
119
|
| Required docstrings | All supported reflection kinds |
|
|
@@ -133,3 +157,17 @@ missing values, and extra positional arguments are rejected.
|
|
|
133
157
|
Normal results are written to stdout and diagnostics to stderr. Exit status `0`
|
|
134
158
|
means success, `1` means documentation or content validation failed, and `2`
|
|
135
159
|
means invocation, configuration, dependency, input, or internal-tool failure.
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
The `@textmode/docs` package is licensed under the [CC0 1.0 Universal](./LICENSE).
|
|
164
|
+
|
|
165
|
+
## Acknowledgements
|
|
166
|
+
|
|
167
|
+
- **[TypeDoc](https://typedoc.org/)**
|
|
168
|
+
- The documentation generator this package orchestrates.
|
|
169
|
+
- License: [Apache-2.0](https://github.com/TypeStrong/typedoc/blob/master/LICENSE).
|
|
170
|
+
|
|
171
|
+
- **[`typedoc-plugin-markdown`](https://typedoc-plugin-markdown.org/)**
|
|
172
|
+
- Markdown output and the frontmatter and VitePress theme plugins used for API pages.
|
|
173
|
+
- License: [MIT License](https://github.com/typedoc2md/typedoc-plugin-markdown/blob/main/LICENSE).
|
package/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export interface TextmodeDocsConfig {
|
|
|
28
28
|
tsconfig?: string;
|
|
29
29
|
memberPageKinds?: MemberPageKind[];
|
|
30
30
|
stripApiSelfLinks?: 'minimal' | 'full';
|
|
31
|
+
editLink?: boolean;
|
|
31
32
|
checks?: DocsChecks;
|
|
32
33
|
examples?: false | ExamplesPolicy;
|
|
33
34
|
typedoc?: Record<string, unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@textmode/docs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "CC0-1.0",
|
|
4
6
|
"description": "Shared documentation generation and validation for the textmode.js ecosystem",
|
|
5
7
|
"keywords": [
|
|
6
8
|
"textmode",
|
|
@@ -9,16 +11,14 @@
|
|
|
9
11
|
"validation"
|
|
10
12
|
],
|
|
11
13
|
"author": "humanbydefinition <hello@textmode.art> (https://code.textmode.art)",
|
|
12
|
-
"license": "MIT",
|
|
13
14
|
"homepage": "https://code.textmode.art",
|
|
14
15
|
"repository": {
|
|
15
16
|
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/
|
|
17
|
+
"url": "git+https://github.com/textmode-art/tooling.git",
|
|
17
18
|
"directory": "packages/docs"
|
|
18
19
|
},
|
|
19
|
-
"type": "module",
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": ">=
|
|
21
|
+
"node": ">=24 <25"
|
|
22
22
|
},
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"typedoc": "^0.28.20",
|
|
39
|
-
"typedoc-plugin-frontmatter": "^1.3.
|
|
39
|
+
"typedoc-plugin-frontmatter": "^1.3.3",
|
|
40
40
|
"typedoc-plugin-markdown": "^4.12.0",
|
|
41
|
-
"typedoc-vitepress-theme": "^1.1.
|
|
41
|
+
"typedoc-vitepress-theme": "^1.1.4"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"typescript": ">=5.9 <7"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"typescript": "^6.0.3"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
|
-
"check": "
|
|
50
|
+
"check": "pnpm run check:format && pnpm run lint && pnpm run test && pnpm run check:package && pnpm run check:pack",
|
|
51
51
|
"check:format": "prettier --check .",
|
|
52
52
|
"check:package": "node scripts/check-package.mjs",
|
|
53
53
|
"check:pack": "node scripts/pack-smoke.mjs",
|
package/src/internal/config.js
CHANGED
|
@@ -12,6 +12,7 @@ const TOP_LEVEL_KEYS = new Set([
|
|
|
12
12
|
'tsconfig',
|
|
13
13
|
'memberPageKinds',
|
|
14
14
|
'stripApiSelfLinks',
|
|
15
|
+
'editLink',
|
|
15
16
|
'checks',
|
|
16
17
|
'examples',
|
|
17
18
|
'typedoc',
|
|
@@ -203,6 +204,9 @@ export function validateDocsConfig(config) {
|
|
|
203
204
|
) {
|
|
204
205
|
throw new Error('stripApiSelfLinks must be "minimal" or "full".');
|
|
205
206
|
}
|
|
207
|
+
if (config.editLink !== undefined && typeof config.editLink !== 'boolean') {
|
|
208
|
+
throw new Error('editLink must be a boolean.');
|
|
209
|
+
}
|
|
206
210
|
if (config.checks !== undefined) {
|
|
207
211
|
validateChecks(config.checks);
|
|
208
212
|
}
|
|
@@ -311,6 +315,7 @@ export async function resolveDocsConfig({ cwd = process.cwd(), configPath: reque
|
|
|
311
315
|
tsconfig: resolveProjectPath(projectRoot, tsconfig),
|
|
312
316
|
memberPageKinds: config.memberPageKinds ?? DEFAULT_MEMBER_PAGE_KINDS,
|
|
313
317
|
stripApiSelfLinks: config.stripApiSelfLinks ?? 'full',
|
|
318
|
+
editLink: config.editLink ?? false,
|
|
314
319
|
checks,
|
|
315
320
|
examples,
|
|
316
321
|
typedoc: { ...DEFAULT_TYPEDOC_OPTIONS, ...(config.typedoc ?? {}) },
|
|
@@ -328,6 +333,7 @@ export async function resolveDocsConfig({ cwd = process.cwd(), configPath: reque
|
|
|
328
333
|
tsconfig: origin(config, 'tsconfig', 'default'),
|
|
329
334
|
memberPageKinds: origin(config, 'memberPageKinds', 'default'),
|
|
330
335
|
stripApiSelfLinks: origin(config, 'stripApiSelfLinks', 'default'),
|
|
336
|
+
editLink: origin(config, 'editLink', 'default'),
|
|
331
337
|
checks: {
|
|
332
338
|
apiLinks: config.checks?.apiLinks ? 'textmode.docs.config.mjs' : 'default',
|
|
333
339
|
docstrings: config.checks?.docstrings ? 'textmode.docs.config.mjs' : 'default',
|
|
@@ -372,6 +378,7 @@ export function formatResolvedConfig(config) {
|
|
|
372
378
|
tsconfig: displayPath(config.projectRoot, config.tsconfig),
|
|
373
379
|
memberPageKinds: config.memberPageKinds,
|
|
374
380
|
stripApiSelfLinks: config.stripApiSelfLinks,
|
|
381
|
+
editLink: config.editLink,
|
|
375
382
|
checks: config.checks,
|
|
376
383
|
examples: config.examples,
|
|
377
384
|
typedoc: config.typedoc,
|
|
@@ -53,25 +53,28 @@ function exampleScopeLabel(targetKinds) {
|
|
|
53
53
|
: 'exported functions and methods';
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
async function
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
tsconfig: config.tsconfig
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
async function loadCheckProjects(config) {
|
|
57
|
+
const entryPoints = config.linkEntryPoints.length
|
|
58
|
+
? config.linkEntryPoints
|
|
59
|
+
: [{ path: config.entryPoints[0], tsconfig: config.tsconfig }];
|
|
60
|
+
return Promise.all(
|
|
61
|
+
entryPoints.map((entryPoint) =>
|
|
62
|
+
loadEntryPointProject({
|
|
63
|
+
entryPoint: entryPoint.path,
|
|
64
|
+
tsconfig: entryPoint.tsconfig,
|
|
65
|
+
packageName: config.packageName,
|
|
66
|
+
projectRoot: config.projectRoot,
|
|
67
|
+
})
|
|
68
|
+
)
|
|
69
|
+
);
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
export async function apiCheck(config, routes, { includeAccessors = false } = {}) {
|
|
70
|
-
const
|
|
73
|
+
const projects = await loadCheckProjects(config);
|
|
71
74
|
const kinds = checkKinds(config, includeAccessors);
|
|
72
|
-
const apiLinkReflections = getIncludedReflections(project, kinds.apiLinks);
|
|
73
|
-
const docstringReflections = getIncludedReflections(project, kinds.docstrings);
|
|
74
|
-
const exampleReflections = getIncludedReflections(project, kinds.examples);
|
|
75
|
+
const apiLinkReflections = projects.flatMap((project) => getIncludedReflections(project, kinds.apiLinks));
|
|
76
|
+
const docstringReflections = projects.flatMap((project) => getIncludedReflections(project, kinds.docstrings));
|
|
77
|
+
const exampleReflections = projects.flatMap((project) => getIncludedReflections(project, kinds.examples));
|
|
75
78
|
const issues = collectApiDocIssues({
|
|
76
79
|
apiBaseUrl: config.apiBaseUrl,
|
|
77
80
|
apiLinkReflections,
|
|
@@ -80,12 +83,15 @@ export async function apiCheck(config, routes, { includeAccessors = false } = {}
|
|
|
80
83
|
routes,
|
|
81
84
|
});
|
|
82
85
|
const issueCount = countApiDocIssues(issues);
|
|
83
|
-
const
|
|
86
|
+
const entryPoints = config.linkEntryPoints.map((entryPoint) => path.relative(config.projectRoot, entryPoint.path));
|
|
87
|
+
const entryPointLabel = entryPoints.join(', ');
|
|
84
88
|
const scopeLabel = exampleScopeLabel(kinds.examples);
|
|
85
89
|
|
|
86
90
|
if (issueCount === 0) {
|
|
87
91
|
console.log('Public API documentation check passed.');
|
|
88
|
-
console.log(
|
|
92
|
+
console.log(
|
|
93
|
+
`Scanned ${docstringReflections.length} documented public API reflections from ${entryPointLabel}.`
|
|
94
|
+
);
|
|
89
95
|
console.log('Policy: skip private/protected/inherited members and any API path segment starting with "_".');
|
|
90
96
|
console.log('Every included API item has a JSDoc docstring and a valid code.textmode.art API link.');
|
|
91
97
|
console.log(`Every included ${scopeLabel} has at least one @example tag.`);
|
|
@@ -96,7 +102,7 @@ export async function apiCheck(config, routes, { includeAccessors = false } = {}
|
|
|
96
102
|
}
|
|
97
103
|
|
|
98
104
|
console.error('Public API documentation check failed.');
|
|
99
|
-
console.error(`Scanned ${docstringReflections.length} documented public API reflections from ${
|
|
105
|
+
console.error(`Scanned ${docstringReflections.length} documented public API reflections from ${entryPointLabel}.`);
|
|
100
106
|
console.error('Policy: skip private/protected/inherited members and any API path segment starting with "_".');
|
|
101
107
|
console.error(
|
|
102
108
|
`Found ${issueCount} issue(s): ${issues.missingDocstrings.length} missing docstring, ${issues.missingExamples.length} missing @example, ${issues.missingApiLinks.length} missing API link, ${issues.invalidApiLinks.length} invalid API link.`
|
|
@@ -32,7 +32,7 @@ Descriptions come from the first useful TypeDoc comment summary on the reflectio
|
|
|
32
32
|
setter signature. The summary is reduced to the first paragraph, sanitized for YAML frontmatter, and truncated to a
|
|
33
33
|
short SEO-friendly length. If no summary exists, the plugin generates a kind-specific fallback description.
|
|
34
34
|
|
|
35
|
-
`lastModified`
|
|
35
|
+
`lastModified` preserves an explicitly supplied source date. A regeneration does not invent a new modification date. The documentation site uses Git history for last-updated and sitemap dates.
|
|
36
36
|
|
|
37
37
|
Packages whose names start with `textmode` are assigned to the `textmode.js` ecosystem. Other package names use their
|
|
38
38
|
own name as the ecosystem.
|
|
@@ -45,13 +45,13 @@ own name as the ecosystem.
|
|
|
45
45
|
templates.
|
|
46
46
|
- Descriptions use the first paragraph, strip markdown links/raw URLs/backticks, collapse whitespace, and truncate to
|
|
47
47
|
160 characters.
|
|
48
|
-
- `lastModified` remains the
|
|
48
|
+
- `lastModified` remains the supplied source date when present, and is omitted otherwise.
|
|
49
49
|
|
|
50
50
|
## Contributor Notes
|
|
51
51
|
|
|
52
52
|
- Safe to edit: constants, helper names, fallback tests, and README wording.
|
|
53
53
|
- Be careful with: YAML sanitization and description truncation, because those values feed SEO metadata.
|
|
54
|
-
- Do not casually change: frontmatter key names, merge precedence, textmode ecosystem detection, or
|
|
54
|
+
- Do not casually change: frontmatter key names, merge precedence, textmode ecosystem detection, or source-date semantics.
|
|
55
55
|
|
|
56
56
|
## Maintenance
|
|
57
57
|
|
|
@@ -49,7 +49,8 @@ export function buildApiFrontmatter(model, existingFrontmatter, library) {
|
|
|
49
49
|
namespace: isInNamespace(model) ? getNamespacePath(model) : undefined,
|
|
50
50
|
kind: ReflectionKind[kind],
|
|
51
51
|
ecosystem: library.ecosystem !== library.name ? library.ecosystem : undefined,
|
|
52
|
-
|
|
52
|
+
// A regeneration is not a content edit. Preserve an explicitly supplied date.
|
|
53
|
+
lastModified: existingFrontmatter.lastModified,
|
|
53
54
|
hasConstructor: getHasConstructor(model),
|
|
54
55
|
isInterface: getIsInterface(model),
|
|
55
56
|
});
|
|
@@ -28,10 +28,6 @@ const BASE_TYPEDOC_OPTIONS = {
|
|
|
28
28
|
exclude: ['**/node_modules/**'],
|
|
29
29
|
...DEFAULT_TYPEDOC_OPTIONS,
|
|
30
30
|
logLevel: 'Verbose',
|
|
31
|
-
frontmatterGlobals: {
|
|
32
|
-
layout: 'doc',
|
|
33
|
-
editLink: true,
|
|
34
|
-
},
|
|
35
31
|
frontmatterCommentTags: ['author', 'since', 'deprecated'],
|
|
36
32
|
preserveFrontmatterCommentTags: false,
|
|
37
33
|
frontmatterNamingConvention: 'camelCase',
|
|
@@ -100,6 +96,10 @@ function applicationOptions(config, { outputDir, strict = false, watch = false }
|
|
|
100
96
|
const { compilerOptions = {}, ...typedocOptions } = config.typedoc;
|
|
101
97
|
return {
|
|
102
98
|
...BASE_TYPEDOC_OPTIONS,
|
|
99
|
+
frontmatterGlobals: {
|
|
100
|
+
layout: 'doc',
|
|
101
|
+
editLink: config.editLink ?? false,
|
|
102
|
+
},
|
|
103
103
|
...typedocOptions,
|
|
104
104
|
entryPoints: config.entryPoints,
|
|
105
105
|
entryPointStrategy: 'resolve',
|