From baa65afe0a2e3f1d9c691c14534fd96fa1477828 Mon Sep 17 00:00:00 2001 From: ruan-cat <1219043956@qq.com> Date: Fri, 29 Nov 2024 11:25:17 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20config(utils):=20=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20typedoc.config.mjs=20=E3=80=82=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/utils/package.json | 2 +- packages/utils/typedoc.config.mjs | 43 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 packages/utils/typedoc.config.mjs diff --git a/packages/utils/package.json b/packages/utils/package.json index 14b94f5..0d74f15 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -17,7 +17,7 @@ "scripts": { "copy-readme": "cpx readme.md docs", "copy-changelog": "cpx CHANGELOG.md docs", - "typedoc": "typedoc --options typedoc.config.cjs", + "typedoc": "typedoc --options typedoc.config.mjs", "prettier-docs-(invalid)": "prettier docs/**/*.md --write", "docs:dev-main": "vuepress-vite dev docs", "docs:dev": "turbo docs:dev", diff --git a/packages/utils/typedoc.config.mjs b/packages/utils/typedoc.config.mjs new file mode 100644 index 0000000..3b1deee --- /dev/null +++ b/packages/utils/typedoc.config.mjs @@ -0,0 +1,43 @@ +// @ts-check + +/** + * @type {import('typedoc').TypeDocOptions & import('typedoc-plugin-markdown').PluginOptions} + * + * 允许使用 `typedoc.config.mjs` 作为配置文件 + * @see https://typedoc.org/documents/Options.Configuration.html#options + * + * 类型声明配置 + * @see https://typedoc-plugin-markdown.org/docs/typedoc-usage#javascript-files + */ +// @ts-ignore +const config = { + name: "本地化示例", + // 指定项目的入口点 + entryPoints: ["./src/index.ts"], + plugin: ["typedoc-plugin-markdown"], + // 指定输出目录 + out: "./docs/typedoc-md", + // 排除不需要生成文档的目录 + exclude: ["node_modules", "libs"], + // 指定 TypeScript 配置文件 + tsconfig: "./tsconfig.json", + gitRevision: "main", + lang: "zh", + excludeExternals: true, + excludePrivate: true, + excludeProtected: true, + // 不需要专门移动readme文件 + readme: "none", + // "readme": "readme.md", + hidePageHeader: true, + hideBreadcrumbs: true, + enumMembersFormat: "table", + parametersFormat: "table", + propertiesFormat: "table", + typeDeclarationFormat: "table", + indexFormat: "table", + useCodeBlocks: true, + expandObjects: true, +}; + +export default config;