forked from open-pioneer/trails-starter
-
Notifications
You must be signed in to change notification settings - Fork 6
/
typedoc.config.cjs
43 lines (40 loc) · 1.58 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 { sync: fastGlobSync } = require("fast-glob");
const { dirname } = require("path");
const documentedPackages = getPackageDirectories().sort();
console.info("Creating documentation for packages:", documentedPackages);
// See https://typedoc.org/options/
module.exports = {
name: "Open Pioneer Packages",
readme: "none",
out: "dist/docs",
entryPointStrategy: "packages",
entryPoints: documentedPackages,
skipErrorChecking: true,
validation: {
notExported: false,
invalidLink: true,
notDocumented: true
}
};
// 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;
}