@graphql-codegen/cli

  • Version 2.6.2
  • Published
  • 227 kB
  • 40 dependencies
  • MIT license

Install

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

Overview

<p align="center"> <img src="https://github.com/dotansimha/graphql-code-generator/blob/master/logo.png?raw=true" /> </p>

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: any[] };
    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' };
    };

      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<Types.FileOutput[]>;

                function findAndLoadGraphQLConfig

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

                  function generate

                  generate: (
                  input: CodegenContext | (Types.Config & { cwd?: string }),
                  saveToFile?: boolean
                  ) => Promise<Types.FileOutput[] | any>;

                    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>;

                            function loadContext

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

                              function parseArgv

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

                                function runCli

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

                                  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 cwd

                                        cwd: string;

                                          property filepath

                                          filepath: string;

                                            property profiler

                                            profiler: Profiler;

                                              property profilerOutput

                                              profilerOutput?: string;

                                                method getConfig

                                                getConfig: <T>(extraConfig?: T) => T & Types.Config;

                                                  method getPluginContext

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

                                                    method loadDocuments

                                                    loadDocuments: (
                                                    pointer: Types.OperationDocument[]
                                                    ) => Promise<Types.DocumentFile[]>;

                                                      method loadSchema

                                                      loadSchema: (pointer: 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,
                                                                (filepath: string, content: string) => Promise<Types.Config> | Types.Config
                                                                >;
                                                                • 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 YamlCliFlags

                                                                        type YamlCliFlags = {
                                                                        config: string;
                                                                        watch: boolean | string | string[];
                                                                        require: string[];
                                                                        overwrite: boolean;
                                                                        project: string;
                                                                        silent: boolean;
                                                                        errorsOnly: boolean;
                                                                        profile: boolean;
                                                                        };

                                                                          Package Files (8)

                                                                          Dependencies (40)

                                                                          Dev Dependencies (0)

                                                                          No dev dependencies.

                                                                          Peer Dependencies (1)

                                                                          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>