-
Notifications
You must be signed in to change notification settings - Fork 0
/
typedoc.config.cjs
43 lines (39 loc) · 1.5 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
// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable @typescript-eslint/no-var-requires */
const { readFileSync } = require("fs");
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"]
};
function getPackageDirectories() {
const packageJsonPaths = fastGlobSync("./src/packages/**/package.json", {
ignore: ["**/dist/**", "**/node_modules/**", "**/test-data/**"],
followSymbolicLinks: false
});
const packageDirectories = packageJsonPaths
.filter((path) => {
const packageJsonContent = JSON.parse(readFileSync(path, "utf-8"));
const isPrivate = !!packageJsonContent.private;
return !isPrivate;
})
.map((path) => dirname(path));
return packageDirectories;
}