How to use the typedoc.ReflectionKind.Class function in typedoc

To help you get started, we’ve selected a few typedoc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mlaursen / react-md / packages / generator / typedoc / typedoc.ts View on Github external
export default async function typedoc(config: ITypeDocConfig) {
  const packages = await getDocumentablePackages();
  const srcPaths = packages.map(name => path.join(PACKAGES_FOLDER, name, "src"));
  const project = compileProject(srcPaths);

  const interfaces = project.getReflectionsByKind(
    ReflectionKind.Interface
  ) as DeclarationReflection[];

  const props = interfaces.filter(intf => /^I.*(?!Default)Props/.test(intf.name));
  const classComponents = project.getReflectionsByKind(ReflectionKind.Class);
  const functionalComponents = project
    .getReflectionsByKind(ReflectionKind.Function)
    .filter(({ name }) => /^[A-Z]/.test(name) && !/Wrapper$/.test(name));

  const components = classComponents.concat(functionalComponents) as DeclarationReflection[];

  console.log("Creating component documentation...");
  const tempDir = path.join(process.cwd(), "docs");
  await fs.ensureDir(tempDir);
  await fs.emptyDir(tempDir);
  await Promise.all(
    components.map(component => {
      // workaround for the ResizeObserrver
      const name = component.name.replace(/Comp$/, "");
      const defaultProps = component.getChildByName("defaultProps") as DeclarationReflection | null;
      const documented: DocumentedComponent = {
github wix / react-native-navigation / scripts / gen-docs / ReflectionsReader.ts View on Github external
public read(rootPath: string): Reflections {
    const expandedFiles = this.typedocApp.expandInputFiles([rootPath]);
    const projectReflection = this.typedocApp.convert(expandedFiles);
    // console.log(JSON.stringify(this.typedocApp.serializer.projectToObject(projectReflection)));

    const externalModules = this.externalModulesWithoutTestsAndMocks(projectReflection);
    const classReflections = this.reflections(externalModules, ReflectionKind.Class);
    const interfaceReflections = this.reflections(externalModules, ReflectionKind.Interface);
    const enumReflections = this.reflections(externalModules, ReflectionKind.Enum);

    return {
      classReflections,
      interfaceReflections,
      enumReflections
    };
  }
github strongloop / strong-docs / src / ts-parser.ts View on Github external
node.kind === ReflectionKind.Enum ||
          node.kind === ReflectionKind.TypeAlias
        ) {
          processMarkdown(node);
          this.constructs.push(new TSConstruct(node));
          createAnchor(node);
          let title = TSHelper.getNodeTitle(node);
          this.sections.push({
            title: title,
            anchor: node.anchorId,
            depth: 3,
          });
          // build sections for children
          let children = node.children;
          if (
            (node.kind === ReflectionKind.Class ||
              node.kind === ReflectionKind.Interface ||
              node.kind === ReflectionKind.ObjectLiteral ||
              node.kind === ReflectionKind.Module ||
              node.kind === ReflectionKind.Enum) &&
            children &&
            children.length > 0
          ) {
            children.forEach((child: Node) => {
              if (
                child.inheritedFrom ||
                child.flags.isPrivate ||
                child.flags.isProtected
              ) {
                child.shouldDocument = false;
              } else {
                // This is needed in UI, good to keep the eligibility logic at one place
github strongloop / loopback-next / packages / tsdocs / src / ts-parser.ts View on Github external
node.kind === ReflectionKind.Enum ||
          node.kind === ReflectionKind.TypeAlias
        ) {
          processMarkdown(node);
          this.constructs.push(new TSConstruct(node));
          createAnchor(node);
          let title = TSHelper.getNodeTitle(node);
          this.sections.push({
            title: title,
            anchor: node.anchorId,
            depth: 3,
          });
          // build sections for children
          let children = node.children;
          if (
            (node.kind === ReflectionKind.Class ||
              node.kind === ReflectionKind.Interface ||
              node.kind === ReflectionKind.ObjectLiteral ||
              node.kind === ReflectionKind.Module ||
              node.kind === ReflectionKind.Enum) &&
            children &&
            children.length > 0
          ) {
            children.forEach((child: Node) => {
              if (
                child.inheritedFrom ||
                child.flags.isPrivate ||
                child.flags.isProtected
              ) {
                child.shouldDocument = false;
              } else {
                // This is needed in UI, good to keep the eligibility logic at one place
github fjc0k / vtils / packages / vtils / scripts / buildDocs.ts View on Github external
'-i',
    /vtils@[^/]+/g,
    `vtils@${pkg.version}`,
    readMeFile,
  )

  // 构建包
  _.exec(`typedoc --ignoreCompilerErrors --excludeNotExported --excludePrivate --excludeProtected --json ${typedocDataFile} --mode file src/index.ts`)

  // 创建文档
  const list = (await fs.readJSON(typedocDataFile)).children as Item[]
  const listByKind = groupBy(list, item => item.kind)
  const briefListByKind: Record = {} as any
  const readMeFlagByKind: Partial> = {
    [ReflectionKind.Function]: '工具函数',
    [ReflectionKind.Class]: '工具类',
    [ReflectionKind.TypeAlias]: '工具类型',
  }
  const contentItemCountPerLineByKind: Partial> = {
    [ReflectionKind.Function]: 4,
    [ReflectionKind.Class]: 3,
    [ReflectionKind.TypeAlias]: 9,
  }

  let readme = (await fs.readFile(readMeFile)).toString()

  forOwn(listByKind, (list, kind) => {
    switch (Number(kind)) {
      case ReflectionKind.Function:
        list.forEach(item => {
          (briefListByKind[kind] || (briefListByKind[kind] = [])).push({
            name: item.name,
github fjc0k / vtils / packages / taro / scripts / buildDocs.ts View on Github external
brief => {
                const sourceUrl = `https://github.com/fjc0k/vtils/blob/master/packages/taro/src/${brief.source.fileName}#L${brief.source.line}`
                const apiUrl = (
                  Number(kind) === ReflectionKind.Class
                    ? `https://fjc0k.github.io/vtils/taro/classes/${brief.name.toLowerCase()}.html`
                    : `https://fjc0k.github.io/vtils/taro/globals.html#${brief.name.toLowerCase()}`
                )
                return dedent`
                  #### ${brief.name}

                  <small>[源码](${sourceUrl}) | [API](${apiUrl}) | [回目录](#目录)</small>

                  ${brief.body}
                `
              },
            ).join('\n\n')
github fjc0k / vtils / packages / react / scripts / buildDocs.ts View on Github external
brief =&gt; {
                const sourceUrl = `https://github.com/fjc0k/vtils/blob/master/packages/react/src/${brief.source.fileName}#L${brief.source.line}`
                const apiUrl = (
                  Number(kind) === ReflectionKind.Class
                    ? `https://fjc0k.github.io/vtils/react/classes/${brief.name.toLowerCase()}.html`
                    : `https://fjc0k.github.io/vtils/react/globals.html#${brief.name.toLowerCase()}`
                )
                return dedent`
                  #### ${brief.name}

                  <small>[源码](${sourceUrl}) | [API](${apiUrl}) | [回目录](#目录)</small>

                  ${brief.body}
                `
              },
            ).join('\n\n')
github tom-grey / typedoc-plugin-markdown / src / theme.ts View on Github external
function getNavigationGroup(reflection: DeclarationReflection) {
      if (reflection.kind === ReflectionKind.ExternalModule) {
        return externalModulesNavigation;
      }
      if (reflection.kind === ReflectionKind.Module) {
        return modulesNavigation;
      }
      if (reflection.kind === ReflectionKind.Class) {
        return classesNavigation;
      }
      if (reflection.kind === ReflectionKind.Enum) {
        return enumsNavigation;
      }
      if (reflection.kind === ReflectionKind.Interface) {
        return interfacesNavigation;
      }
      return null;
    }