@graphql-codegen/cli

  • Version 8.0.0
  • Published
  • 271 kB
  • 35 dependencies
  • MIT license

Install

npm i @graphql-codegen/cli
yarn add @graphql-codegen/cli
pnpm add @graphql-codegen/cli

Overview

Overview not available.

Index

Variables

variable CodegenExtension

const CodegenExtension: GraphQLExtensionDeclaration;

    Functions

    function buildOptions

    buildOptions: () => {
    c: { alias: string; type: 'string'; describe: string };
    w: {
    alias: string;
    describe: string;
    coerce(watch: any): string | boolean | any[];
    };
    r: { alias: string; describe: string; type: 'array'; default: never[] };
    o: { alias: string; describe: string; type: 'boolean' };
    s: { alias: string; describe: string; type: 'boolean' };
    e: { alias: string; describe: string; type: 'boolean' };
    profile: { describe: string; type: 'boolean' };
    p: { alias: string; describe: string; type: 'string' };
    v: { alias: string; describe: string; type: 'boolean'; default: boolean };
    check: { describe: string; type: 'boolean' };
    d: { alias: string; describe: string; type: 'boolean'; default: boolean };
    'import-extension': { describe: string; type: 'string' };
    'ignore-no-documents': { describe: string; type: 'boolean' };
    };

      function cliError

      cliError: (err: any, exitOnError?: boolean) => void;

        function createContext

        createContext: (cliFlags?: YamlCliFlags) => Promise<CodegenContext>;

          function ensureContext

          ensureContext: (input: CodegenContext | Types.Config) => CodegenContext;

            function ensureGraphQlPackage

            ensureGraphQlPackage: () => Promise<void>;

              function executeCodegen

              executeCodegen: (
              input: CodegenContext | Types.Config
              ) => Promise<{ result: Types.FileOutput[]; error: Error | null }>;

                function findAndLoadGraphQLConfig

                findAndLoadGraphQLConfig: (filepath?: string) => Promise<GraphQLConfig | void>;

                  function generate

                  generate: (
                  input: CodegenContext | (Types.Config & { cwd?: string }),
                  saveToFile?: boolean
                  ) => Promise<Types.FileOutput[] | void>;
                  • Generates code from the config. Resolves with the generated files. In watch mode, the promise doesn't resolve until the watcher exits, and it resolves with no value.

                  function generateSearchPlaces

                  generateSearchPlaces: (moduleName: string) => string[];

                    function init

                    init: () => Promise<void>;

                      function isListrError

                      isListrError: (
                      err: Error & { name?: unknown; errors?: unknown }
                      ) => err is ListrError;

                        function loadCodegenConfig

                        loadCodegenConfig: ({
                        configFilePath,
                        moduleName,
                        searchPlaces: additionalSearchPlaces,
                        packageProp,
                        loaders: customLoaders,
                        }: LoadCodegenConfigOptions) => Promise<LoadCodegenConfigResult | null>;

                          function loadContext

                          loadContext: (configFilePath?: string) => Promise<CodegenContext> | never;

                            function parseArgv

                            parseArgv: (argv?: string[]) => YamlCliFlags;

                              function runCli

                              runCli: (cmd: string) => Promise<number>;

                                function updateContextWithCliFlags

                                updateContextWithCliFlags: (
                                context: CodegenContext,
                                cliFlags: YamlCliFlags
                                ) => void;

                                  Classes

                                  class CodegenContext

                                  class CodegenContext {}

                                    constructor

                                    constructor({
                                    config,
                                    graphqlConfig,
                                    filepath,
                                    }: {
                                    config?: Types.Config;
                                    graphqlConfig?: GraphQLConfig;
                                    filepath?: string;
                                    });

                                      property checkMode

                                      readonly checkMode: boolean;

                                        property checkModeStaleFiles

                                        checkModeStaleFiles: string[];

                                          property cwd

                                          cwd: string;

                                            property filepath

                                            filepath?: string;

                                              property profiler

                                              profiler: Profiler;

                                                method enableCheckMode

                                                enableCheckMode: () => void;

                                                  method getConfig

                                                  getConfig: { (): Types.Config; <T>(extraConfig: T): any };

                                                    method getPluginContext

                                                    getPluginContext: () => { [key: string]: any };

                                                      method loadDocuments

                                                      loadDocuments: (
                                                      pointer: UnnormalizedTypeDefPointer,
                                                      type: 'standard' | 'external'
                                                      ) => Promise<Types.DocumentFile[]>;

                                                        method loadSchema

                                                        loadSchema: (pointer: Types.Schema | Types.Schema[]) => Promise<GraphQLSchema>;

                                                          method updateConfig

                                                          updateConfig: (config: Types.Config) => void;

                                                            method useProfiler

                                                            useProfiler: () => void;

                                                              method useProject

                                                              useProject: (name?: string) => void;

                                                                Interfaces

                                                                interface LoadCodegenConfigOptions

                                                                interface LoadCodegenConfigOptions {}

                                                                  property configFilePath

                                                                  configFilePath?: string;
                                                                  • The path to the config file or directory contains the config file. process.cwd()

                                                                  property loaders

                                                                  loaders?: Record<string, CodegenConfigLoader>;
                                                                  • Overrides or extends the loaders for specific file extensions

                                                                  property moduleName

                                                                  moduleName?: string;
                                                                  • The name of the config file codegen

                                                                  property packageProp

                                                                  packageProp?: string;
                                                                  • codegen

                                                                  property searchPlaces

                                                                  searchPlaces?: string[];
                                                                  • Additional search paths for the config file you want to check

                                                                  interface LoadCodegenConfigResult

                                                                  interface LoadCodegenConfigResult {}

                                                                    property config

                                                                    config: Types.Config;

                                                                      property filepath

                                                                      filepath: string;

                                                                        property isEmpty

                                                                        isEmpty?: boolean;

                                                                          Type Aliases

                                                                          type CodegenConfig

                                                                          type CodegenConfig = Types.Config;

                                                                            type CodegenConfigLoader

                                                                            type CodegenConfigLoader = (
                                                                            filepath: string,
                                                                            content: string
                                                                            ) => Promise<Types.Config> | Types.Config;

                                                                              type YamlCliFlags

                                                                              type YamlCliFlags = {
                                                                              config: string;
                                                                              watch: boolean | string | string[];
                                                                              require: string[];
                                                                              overwrite: boolean;
                                                                              project: string;
                                                                              silent: boolean;
                                                                              errorsOnly: boolean;
                                                                              profile: boolean;
                                                                              check?: boolean;
                                                                              verbose?: boolean;
                                                                              debug?: boolean;
                                                                              ignoreNoDocuments?: boolean;
                                                                              importExtension?: '' | `.${string}`;
                                                                              'ignore-no-documents'?: boolean;
                                                                              'import-extension'?: '' | `.${string}`;
                                                                              };

                                                                                Package Files (8)

                                                                                Dependencies (35)

                                                                                Dev Dependencies (0)

                                                                                No dev dependencies.

                                                                                Peer Dependencies (2)

                                                                                Badge

                                                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@graphql-codegen/cli.

                                                                                • Markdown
                                                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@graphql-codegen/cli)
                                                                                • HTML
                                                                                  <a href="https://www.jsdocs.io/package/@graphql-codegen/cli"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>