react-native-navigation的迁移库

Main.ts 1.3KB

123456789101112131415161718192021222324252627282930313233
  1. import * as fs from 'fs';
  2. import { ReflectionsReader } from './ReflectionsReader';
  3. import { ClassParser } from './ClassParser';
  4. import { MarkdownWriter } from './MarkdownWriter';
  5. import { ReflectionKind } from 'typedoc';
  6. import { EnumParser } from './EnumParser';
  7. const INPUT_DIR = `${__dirname}/../../lib/src`;
  8. const OUTPUT_DIR = `${__dirname}/../../docs/api`;
  9. const TEMPLATES_DIR = `${__dirname}/templates`;
  10. const TSCONFIG_PATH = `${__dirname}/../../tsconfig.json`;
  11. const SOURCE_LINK_PREFIX = `https://github.com/wix/react-native-navigation/blob/v2/lib/src`;
  12. class Main {
  13. public run() {
  14. const classParser = new ClassParser(SOURCE_LINK_PREFIX);
  15. const enumParser = new EnumParser();
  16. const markdownWriter = new MarkdownWriter(TEMPLATES_DIR, OUTPUT_DIR);
  17. const reflections = new ReflectionsReader(TSCONFIG_PATH).read(INPUT_DIR);
  18. const parsedClasses = classParser.parseClasses(reflections.classReflections);
  19. const parsedInterfaces = classParser.parseClasses(reflections.interfaceReflections);
  20. const parsedEnums = enumParser.parse(reflections.enumReflections);
  21. markdownWriter.writeClasses(parsedClasses);
  22. markdownWriter.writeClasses(parsedInterfaces);
  23. markdownWriter.writeEnums(parsedEnums);
  24. markdownWriter.writeMenu(parsedClasses, parsedInterfaces, parsedEnums);
  25. }
  26. }
  27. new Main().run();