fix(core): update
This commit is contained in:
		
							
								
								
									
										42
									
								
								ts/cli.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								ts/cli.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
import * as plugins from './plugins.js';
 | 
			
		||||
import * as paths from './paths.js';
 | 
			
		||||
import { logger } from './logging.js';
 | 
			
		||||
 | 
			
		||||
import { TypeDoc } from './classes.typedoc.js';
 | 
			
		||||
import { AiDoc } from './classes.aidoc.js';
 | 
			
		||||
 | 
			
		||||
export const run = async () => {
 | 
			
		||||
  const tsdocCli = new plugins.smartcli.Smartcli();
 | 
			
		||||
 | 
			
		||||
  tsdocCli.standardCommand().subscribe(async (argvArg) => {
 | 
			
		||||
    logger.log('warn', `Auto detecting environment!`);
 | 
			
		||||
    switch (true) {
 | 
			
		||||
      case await TypeDoc.isTypeDocDir(paths.cwd):
 | 
			
		||||
        logger.log('ok', `Detected TypeDoc compliant directory at ${paths.cwd}`);
 | 
			
		||||
        tsdocCli.triggerCommand('typedoc', argvArg);
 | 
			
		||||
        break;
 | 
			
		||||
      default:
 | 
			
		||||
        logger.log('error', `Cannot determine docs format at ${paths.cwd}`);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  tsdocCli.addCommand('typedoc').subscribe(async (argvArg) => {
 | 
			
		||||
    const typeDocInstance = new TypeDoc(paths.cwd);
 | 
			
		||||
    await typeDocInstance.compile({
 | 
			
		||||
      publicSubdir: argvArg.publicSubdir,
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  tsdocCli.addCommand('aidocs').subscribe(async (argvArg) => {
 | 
			
		||||
    const aidocs = new AiDoc();
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  tsdocCli.addCommand('test').subscribe((argvArg) => {
 | 
			
		||||
    tsdocCli.triggerCommand('typedoc', argvArg);
 | 
			
		||||
    process.on('exit', async () => {
 | 
			
		||||
      await plugins.smartfile.fs.remove(paths.publicDir);
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  tsdocCli.startParse();
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user