UNPKG

@graphql-markdown/cli

Version:

NodeJS CLI for generating Markdown documentation from a GraphQL schema.

53 lines (52 loc) 1.86 kB
/** * 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. * * @module cli * @see {@link https://graphql-markdown.dev | GraphQL Markdown Documentation} */ import type { CliOptions, GraphQLMarkdownCliOptions } from "@graphql-markdown/types"; import type { CommanderStatic } from "commander"; /** * Type representing the GraphQL Markdown CLI. * * @see {@link https://graphql-markdown.dev | GraphQL Markdown Documentation} */ export type GraphQLMarkdownCliType = CommanderStatic; /** * Runs the GraphQL Markdown CLI to generate documentation from a GraphQL schema. * * @param options - Options for configuring the GraphQL Markdown CLI. * @param cliOptions - Command-line options passed to the CLI. * @param loggerModule - Optional logger module to use. * * @example * ```typescript * await runGraphQLMarkdown( * { id: "custom" }, * { schema: "./schema.graphql", root: "./docs" }, * "custom-logger" * ); * ``` */ export declare const runGraphQLMarkdown: (options: GraphQLMarkdownCliOptions, cliOptions: CliOptions, loggerModule?: string) => Promise<void>; /** * Configures and returns the GraphQL Markdown CLI. * * @param options - Options for configuring the GraphQL Markdown CLI. * @param loggerModule - Optional logger module to use. * @param customMdxParser - Optional MDX parser configuration. * * @returns The configured CLI instance. * * @example * ```typescript * const cli = getGraphQLMarkdownCli( * { id: "custom" }, * "custom-logger", * true * ); * await cli.parseAsync(process.argv); * ``` */ export declare const getGraphQLMarkdownCli: (options: GraphQLMarkdownCliOptions, loggerModule?: string, customMdxParser?: boolean | string) => GraphQLMarkdownCliType;