code: async function onCreateNode({
    node,
    actions,
    loadNodeContent,
    createNodeId,
    createContentDigest,
  }) {
    if (!canParse(node)) return
  
    const sourceText = await loadNodeContent(node);
    let parsed = null;
    try {
      if (isTSX(node)) {
        // Load up the already transpiled file
        const transpiledPath = node.absolutePath
          .replace(/react-(.*)\/src/, 'react-$1/dist/esm')
          .replace(/\.tsx?$/, '.js');
        const jsText = fs.readFileSync(transpiledPath, 'utf8');
        parsed = docgenJavascript.parse(jsText);
      }
      else if (isJSX(node)) {
        parsed = docgenJavascript.parse(sourceText);
      }
    } catch (err) {
      console.warn('No component found in', node.absolutePath);
    }
  
    if (parsed) {
      const metadataNode = {
        name: parsed.displayName,
        description: parsed.description,
        props: flattenProps(parsed.props),
        path: node.relativePath,
        basePath: node.relativePath.split('/')[0],
        id: createNodeId(`${node.id}imunique${node.relativePath}`),
        children: [],
        parent: node.id,
        internal: {
          contentDigest: createContentDigest(node),
          type: `ComponentMetadata`,
        },
      }
      actions.createNode(metadataNode)
      actions.createParentChildLink({ parent: node, child: metadataNode })
    }
  }
docs: Docs https://www.gatsbyjs.org/docs/actions/#createNode