typedoc-plugin-missing-exports
typedoc-plugin-missing-exports copied to clipboard
Setting 'excludeExternals' doesn't exclude imports from node_modules
I use typedoc in my JS script to generate documentation for multiple packages in monorepo. I run the script, but get types from node_modules in -internal- folder. Setting excludeExternals to true doesn't exclude this types. I tried to set different patterns to externalPattern option: /node_modules/, node_modules/**/*.ts, **/node_modules/**, but nothing solve the problem.
Expected result: only internal types from my packages will be included in the generated documentation and any types from node_modules will be removed from result.
Here is my script with typedoc config:
import * as td from "typedoc";
import { glob } from "glob";
import fs from "fs";
import { repoRootDir } from "@biom/config/utils/monorepo.js";
import path from "path";
const generatedDocsDir = "apps/docs/pages/packages";
const packages = glob
.sync("./packages/*", {
absolute: true,
cwd: repoRootDir,
})
.filter((dir) => fs.existsSync(path.resolve(dir, "typedoc.json")));
await fs.promises.rm(generatedDocsDir, { recursive: true, force: true });
const app = await td.Application.bootstrapWithPlugins({
entryPoints: packages,
exclude: ["packages/example"],
name: "BIOM Packages",
entryPointStrategy: "packages",
excludeScopesInPaths: true,
fileExtension: ".mdx",
includeVersion: false,
compilerOptions: {
skipLibCheck: true,
},
packageOptions: {
includeVersion: true,
entryPoints: ["src/index.ts"],
},
outputs: [
{
name: "markdown",
path: generatedDocsDir,
},
],
out: generatedDocsDir,
plugin: [
"typedoc-plugin-markdown",
"typedoc-plugin-mdn-links",
"typedoc-plugin-missing-exports",
"@biom/typedoc-plugin-changelog",
"@biom/typedoc-plugin-pretty-navigation",
],
categorizeByGroup: false,
groupReferencesByType: false,
expandObjects: true,
readme: "none",
hidePageHeader: true,
hideBreadcrumbs: true,
expandParameters: true,
useHTMLEncodedBrackets: true,
parametersFormat: "table",
interfacePropertiesFormat: "table",
enumMembersFormat: "table",
propertyMembersFormat: "table",
typeDeclarationFormat: "table",
classPropertiesFormat: "table",
typeDeclarationVisibility: "compact",
pageTitleTemplates: {
index: "{projectName} {version}",
member: "{name}",
module: "{name}",
},
navigation: {
includeCategories: false,
includeGroups: false,
includeFolders: false,
compactFolders: true,
excludeReferences: true,
},
excludeExternals: true,
externalPattern: "**/node_modules/**",
excludeReferences: true,
placeInternalsInOwningModule: true
});
const project = await app.convert();
if (project) {
await app.generateOutputs(project);
}
Sorry for my English and thanks for the help!
See https://typedoc.org/documents/Options.Package_Options.html
That option also needs to be set in packageOptions so that it takes effect during conversion. The option is not set when converting with your current script.