2024-04-03 11:34:26 +00:00
|
|
|
import * as plugins from './plugins.js';
|
|
|
|
import * as paths from './paths.js';
|
|
|
|
import { logger } from './logging.js';
|
2019-05-13 17:41:02 +00:00
|
|
|
|
2024-04-03 11:34:26 +00:00
|
|
|
import { TypeDoc } from './classes.typedoc.js';
|
|
|
|
import { AiDoc } from './classes.aidoc.js';
|
2019-05-14 15:39:33 +00:00
|
|
|
|
2019-05-13 17:41:02 +00:00
|
|
|
export const run = async () => {
|
|
|
|
const tsdocCli = new plugins.smartcli.Smartcli();
|
|
|
|
|
2022-09-16 06:22:57 +00:00
|
|
|
tsdocCli.standardCommand().subscribe(async (argvArg) => {
|
2019-05-14 06:50:50 +00:00
|
|
|
logger.log('warn', `Auto detecting environment!`);
|
2019-05-14 15:39:33 +00:00
|
|
|
switch (true) {
|
|
|
|
case await TypeDoc.isTypeDocDir(paths.cwd):
|
|
|
|
logger.log('ok', `Detected TypeDoc compliant directory at ${paths.cwd}`);
|
2022-09-16 06:22:57 +00:00
|
|
|
tsdocCli.triggerCommand('typedoc', argvArg);
|
2019-05-14 15:39:33 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
logger.log('error', `Cannot determine docs format at ${paths.cwd}`);
|
|
|
|
}
|
2019-05-14 06:50:50 +00:00
|
|
|
});
|
2019-05-13 17:41:02 +00:00
|
|
|
|
2020-11-24 20:24:30 +00:00
|
|
|
tsdocCli.addCommand('typedoc').subscribe(async (argvArg) => {
|
|
|
|
const typeDocInstance = new TypeDoc(paths.cwd);
|
2020-11-27 12:02:57 +00:00
|
|
|
await typeDocInstance.compile({
|
2021-03-06 19:21:13 +00:00
|
|
|
publicSubdir: argvArg.publicSubdir,
|
2020-11-27 12:02:57 +00:00
|
|
|
});
|
2020-11-24 20:24:30 +00:00
|
|
|
});
|
|
|
|
|
2024-04-13 14:22:33 +00:00
|
|
|
tsdocCli.addCommand('aidoc').subscribe(async (argvArg) => {
|
2024-04-13 22:40:57 +00:00
|
|
|
const aidocInstance = new AiDoc();
|
|
|
|
await aidocInstance.start();
|
2024-10-28 20:45:28 +00:00
|
|
|
logger.log('info', `Generating new readme...`);
|
|
|
|
logger.log('info', `This may take some time...`);
|
|
|
|
await aidocInstance.buildReadme(paths.cwd);
|
2024-04-12 13:35:09 +00:00
|
|
|
logger.log('info', `Generating new keywords...`);
|
|
|
|
logger.log('info', `This may take some time...`);
|
2024-10-28 20:45:28 +00:00
|
|
|
await aidocInstance.buildDescription(paths.cwd);
|
2024-06-22 11:20:55 +00:00
|
|
|
});
|
2024-03-31 13:09:30 +00:00
|
|
|
|
2020-11-24 20:24:30 +00:00
|
|
|
tsdocCli.addCommand('test').subscribe((argvArg) => {
|
2022-09-16 06:22:57 +00:00
|
|
|
tsdocCli.triggerCommand('typedoc', argvArg);
|
2019-05-27 14:11:10 +00:00
|
|
|
process.on('exit', async () => {
|
|
|
|
await plugins.smartfile.fs.remove(paths.publicDir);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2019-05-14 06:50:50 +00:00
|
|
|
tsdocCli.startParse();
|
|
|
|
};
|