-
Notifications
You must be signed in to change notification settings - Fork 8
/
typedoc.config.cjs
47 lines (43 loc) · 1.77 KB
/
typedoc.config.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable @typescript-eslint/no-require-imports */
const { sync: fastGlobSync } = require("fast-glob");
const { dirname } = require("path");
const DEFAULT_HIGHLIGHT_LANGS = require("typedoc").OptionDefaults.highlightLanguages;
const documentedPackages = getPackageDirectories().sort();
console.info("Creating documentation for packages:", documentedPackages);
// See https://typedoc.org/options/
module.exports = {
name: "Trails Packages",
readme: "none",
out: "dist/docs",
entryPointStrategy: "packages",
entryPoints: documentedPackages,
skipErrorChecking: true,
validation: {
notExported: false,
invalidLink: true,
notDocumented: true
},
// 'tsx' is in default, but 'jsx' is not..
highlightLanguages: [...DEFAULT_HIGHLIGHT_LANGS, "jsx"]
};
// Returns a list of package directories to be documented.
// Each directory must contain a package.json file.
function getPackageDirectories() {
const packageJsonPaths = fastGlobSync("./src/packages/**/package.json", {
ignore: ["**/dist/**", "**/node_modules/**"],
followSymbolicLinks: false
});
const packageDirectories = packageJsonPaths
// If you only want to document non-private packages, use a condition like the one below.
// readFileSync can be imported via node: `const { readFileSync } = require("fs");`
//
// .filter((path) => {
// const packageJsonContent = JSON.parse(readFileSync(path, "utf-8"));
// const isPrivate = !!packageJsonContent.private;
// return !isPrivate;
// })
.map((path) => dirname(path));
return packageDirectories;
}