2019-05-13 17:41:02 +00:00
|
|
|
import * as plugins from './tsdoc.plugins';
|
2019-05-14 15:39:33 +00:00
|
|
|
import * as paths from './tsdoc.paths';
|
2019-05-13 17:41:02 +00:00
|
|
|
|
2019-05-14 15:39:33 +00:00
|
|
|
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) {
|
2019-05-15 19:23:45 +00:00
|
|
|
this.typedocDirectory = dirPathArg;
|
2019-05-14 15:39:33 +00:00
|
|
|
}
|
|
|
|
|
2019-05-15 19:23:45 +00:00
|
|
|
public async compile() {
|
2019-10-14 10:59:25 +00:00
|
|
|
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;
|
|
|
|
|
2019-05-15 19:23:45 +00:00
|
|
|
await this.smartshellInstance.exec(
|
2019-10-14 10:59:25 +00:00
|
|
|
`typedoc --tsconfig ${paths.tsconfigFile} --out public/ ${tsDir}`
|
2019-05-15 19:23:45 +00:00
|
|
|
);
|
2019-05-14 15:39:33 +00:00
|
|
|
}
|
|
|
|
}
|