40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
|
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') : "";
|
||
|
});
|
||
|
|