(commands: Command[], rootName: string)
| 546 | } |
| 547 | |
| 548 | function buildIndexDoc(commands: Command[], rootName: string): CommandDoc { |
| 549 | const root: Root = { |
| 550 | type: "root", |
| 551 | children: [ |
| 552 | createHeading(2, "Introduction"), |
| 553 | createParagraph( |
| 554 | `This page aggregates CLI reference docs for ${rootName} commands.`, |
| 555 | ), |
| 556 | ], |
| 557 | }; |
| 558 | |
| 559 | commands.forEach((command) => { |
| 560 | root.children.push( |
| 561 | ...buildCommandSection({ |
| 562 | command, |
| 563 | rootName, |
| 564 | ancestors: [], |
| 565 | depth: 2, |
| 566 | useRootIntro: false, |
| 567 | }), |
| 568 | ); |
| 569 | }); |
| 570 | |
| 571 | const markdown = toMarkdown(root); |
| 572 | const frontmatter = [ |
| 573 | FRONTMATTER_DELIMITER, |
| 574 | `title: ${formatYamlValue(`${rootName} CLI reference`)}`, |
| 575 | "seo:", |
| 576 | " noindex: true", |
| 577 | FRONTMATTER_DELIMITER, |
| 578 | "", |
| 579 | ].join("\n"); |
| 580 | |
| 581 | const mdx = `${frontmatter}${markdown}\n`; |
| 582 | |
| 583 | return { |
| 584 | fileName: "index.mdx", |
| 585 | markdown, |
| 586 | mdx, |
| 587 | commandPath: `${rootName} (index)`, |
| 588 | }; |
| 589 | } |
| 590 | |
| 591 | async function main(): Promise<void> { |
| 592 | const repoRoot = getRepoRoot(); |
no test coverage detected