Skip to main content

cli

This module provides the CLI functionality for generating documentation from GraphQL schemas. It exports utilities to run the documentation generator both programmatically and via CLI.

See​

GraphQL Markdown Documentation

GraphQLMarkdownCliType​

type GraphQLMarkdownCliType = CommanderStatic;

Defined in: index.ts:29

Type representing the GraphQL Markdown CLI.

See​

GraphQL Markdown Documentation


getGraphQLMarkdownCli()​

function getGraphQLMarkdownCli(
options,
loggerModule?,
customFormatter?,
): CommanderStatic;

Defined in: index.ts:86

Configures and returns the GraphQL Markdown CLI.

Parameters​

options​

ConfigOptions

Options for configuring the GraphQL Markdown CLI.

loggerModule?​

string

Optional logger module to use.

customFormatter?​

string

Optional default formatter package name. When provided, registers --formatter and --mdxParser (deprecated) flags with this value as the default.

Returns​

CommanderStatic

The configured CLI instance.

Example​

const cli = getGraphQLMarkdownCli(
{ id: "custom" },
"custom-logger",
"@graphql-markdown/formatters/docusaurus",
);
await cli.parseAsync(process.argv);

runGraphQLMarkdown()​

function runGraphQLMarkdown(options, cliOptions, loggerModule?): Promise<void>;

Defined in: index.ts:47

Runs the GraphQL Markdown CLI to generate documentation from a GraphQL schema.

Parameters​

options​

ConfigOptions

Options for configuring the GraphQL Markdown CLI.

cliOptions​

CliOptions

Command-line options passed to the CLI.

loggerModule?​

string

Optional logger module to use.

Returns​

Promise<void>

Example​

await runGraphQLMarkdown(
{ id: "custom" },
{ schema: "./schema.graphql", root: "./docs" },
"custom-logger",
);