graphql-config
GraphQL Markdown configuration utilities
This module provides utilities for loading and processing GraphQL configuration using the graphql-config package.
EXTENSION_NAMEβ
const EXTENSION_NAME: "graphql-markdown";
Defined in: graphql-config.ts:25
The name of the GraphQL Markdown extension. Used to identify the extension in graphql-config.
graphQLConfigExtensionβ
const graphQLConfigExtension: GraphQLExtensionDeclaration;
Defined in: graphql-config.ts:40
GraphQL extension declaration for graphql-config.
Returnsβ
The extension configuration object with name property.
Exampleβ
// In graphql-config setup
const config = await loadConfig({
extensions: [graphQLConfigExtension],
});
loadConfiguration()β
function loadConfiguration(
id,
options?,
throwOptions?): Promise<Maybe<Readonly<ExtensionProjectConfig>>>
Defined in: graphql-config.ts:127
Loads the GraphQL Markdown configuration from graphql-config.
This function attempts to load the GraphQL config and extract the GraphQL Markdown extension configuration for the specified project ID. It also normalizes schema configurations.
Parametersβ
idβ
Maybe
<string
>
The project ID to load configuration for.
options?β
Maybe
<PackageOptionsConfig
>
Optional package options to apply.
throwOptions?β
ThrowOptions
= ...
Options for controlling throw behavior.
Returnsβ
Promise
<Maybe
<Readonly
<ExtensionProjectConfig
>>>
The extension project configuration if found, otherwise undefined.
Throwsβ
Will throw an error if throwOnMissing or throwOnEmpty is true and the corresponding condition is met.
Exampleβ
// Basic usage
const config = await loadConfiguration("my-project");
// With options and throw behavior
const config = await loadConfiguration(
"my-project",
{ baseDir: "./src" },
{ throwOnMissing: true, throwOnEmpty: false }
);
setLoaderOptions()β
function setLoaderOptions(loaders, options): LoaderOption
Defined in: graphql-config.ts:79
Sets loader options for GraphQL Markdown loaders.
This function takes a LoaderOption object and merges the provided options with any existing options for each loader.
Parametersβ
loadersβ
LoaderOption
The loader configuration object.
optionsβ
PackageOptionsConfig
The package options to apply to loaders.
Returnsβ
LoaderOption
The updated loader configuration.
Exampleβ
const loaders = {
TypeScriptLoader: {
module: "@graphql-markdown/typescript-loader",
options: { baseDir: "./src" }
}
};
const options = { outputDir: "./docs" };
const updatedLoaders = setLoaderOptions(loaders, options);
// Result: loaders with { baseDir: "./src", outputDir: "./docs" }