-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Typedoc setup for integrating generated api docs
- Loading branch information
Showing
6 changed files
with
96 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"entryPoints": ["src/index.ts"], | ||
"excludeNotDocumented": false, | ||
"plugin":[ | ||
"typedoc-plugin-mdn-links", | ||
"typedoc-plugin-missing-exports", | ||
"./typedocExcludeUnderscore.mjs" | ||
], | ||
"out": "docs/api", | ||
"visibilityFilters": { | ||
"protected": false, | ||
"private": false, | ||
"inherited": true, | ||
"external": false | ||
}, | ||
"excludePrivate": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Converter, ReflectionFlag, ReflectionKind } from "typedoc"; | ||
import camelCase from "camelcase"; | ||
|
||
/** | ||
* @param {Readonly<import('typedoc').Application>} app | ||
*/ | ||
export function load(app) { | ||
/** | ||
* Create declaration event handler that sets symbols with underscore-prefixed names | ||
* to private to exclude from generated documentation. | ||
* | ||
* Due to "partial class" style of code in use, otherwise private properties and methods - | ||
* prefixed with underscore - are effectively declared public so they can be accessed in other | ||
* files used to build class - e.g. Model. This marks anything prefixed with an underscore and | ||
* no doc comment as private. | ||
* | ||
* @param {import('typedoc').Context} context | ||
* @param {import('typedoc').DeclarationReflection} reflection | ||
*/ | ||
function handleCreateDeclaration(context, reflection) { | ||
if (!reflection.name.startsWith('_')) { | ||
return; | ||
} | ||
if (!reflection.comment) { | ||
reflection.setFlag(ReflectionFlag.Private); | ||
} | ||
} | ||
|
||
app.converter.on(Converter.EVENT_CREATE_DECLARATION, handleCreateDeclaration); | ||
} |