kdayun-compnent-develop/kdayun-component-demo/doc.js

40 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2022-02-19 20:37:32 +08:00
const TypeDoc = require("yh-designer-doc");
async function main(hyDocOptions) {
const app = new TypeDoc.Application();
app.options.addReader(new TypeDoc.TSConfigReader());
app.options.addReader(new TypeDoc.TypeDocReader());
app.bootstrap(hyDocOptions);
const project = app.convert();
if (project) {
await app.generateDocs(project, hyDocOptions.out);
await app.generateJson(project, hyDocOptions.json);
await app.generateTypesTxt(project, hyDocOptions.out, hyDocOptions.typestxtPath);
}
}
var package = require('./package.json');
main({
name: package.name + ' ' + package.description,
entryPoints: [
"./src"
],
out: './dist/docs/',
exclude: '**/node_modules/**/*.*',
excludeExternals: true,
theme: "minimal",
version: true,
json: './src/docs.json',
typestxtPath: './dist/types.txt',
toc: ["EntryClass", "ImportantInterface"]
}).catch(console.error);
const fs = require("fs");
//清除掉docs.json'文件的内容 减少体积
fs.exists('./dist/docs.json', function (exists) {
exists ? fs.unlinkSync('./dist/docs.json') : "";
});