aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/generate-docs.ts
blob: ad57e4e6941daee1cb86a16b4735c0f1d255872d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { Command } from 'commander';
import { logger } from '../lib/logger';
import { generateDocs } from './docs';

process.on('unhandledRejection', (err) => {
  // Will print "unhandledRejection err is not defined"
  logger.error({ err }, 'unhandledRejection');
  process.exit(-1);
});

const program = new Command('pnpm build:docs')
  .description('Generate docs')
  .option('--mkdocs', 'generate docs for mkdocs')
  .action(async (opts) => {
    if (opts.mkdocs) {
      logger.info('Generating for mkdocs');
      await generateDocs('tools/mkdocs', false);
    } else {
      logger.info('Generating docs for testing');
      await generateDocs();
    }
    logger.info('Generation completed');
  });

void program.parseAsync();