tsdoc/ts/tsdoc.classes.typedoc.ts
2019-10-14 12:59:25 +02:00

34 lines
997 B
TypeScript

import * as plugins from './tsdoc.plugins';
import * as paths from './tsdoc.paths';
export class TypeDoc {
public smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash',
pathDirectories: [paths.binDir]
});
// Static
public static async isTypeDocDir(dirPathArg: string): Promise<boolean> {
const result = await plugins.smartfile.fs.fileExists(
plugins.path.join(dirPathArg, 'mkdocs.yml')
);
return !result;
}
// Instance
public typedocDirectory: string;
constructor(dirPathArg) {
this.typedocDirectory = dirPathArg;
}
public async compile() {
let tsDir: 'ts' | 'ts_web';
plugins.smartfile.fs.isDirectory(plugins.path.join(this.typedocDirectory, 'ts')) ? tsDir = 'ts' : null;
plugins.smartfile.fs.isDirectory(plugins.path.join(this.typedocDirectory, 'ts_web')) ? tsDir = 'ts_web' : null;
await this.smartshellInstance.exec(
`typedoc --tsconfig ${paths.tsconfigFile} --out public/ ${tsDir}`
);
}
}