@graphql-codegen/cli

  • Version 5.0.2
  • Published
  • 240 kB
  • 35 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' };
    v: { alias: string; describe: string; type: 'boolean'; default: boolean };
    d: { alias: string; describe: string; type: 'boolean'; default: 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<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<number>;

                                  function shouldEmitLegacyCommonJSImports

                                  shouldEmitLegacyCommonJSImports: (config: Types.Config) => boolean;

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

                                              property cwd

                                              cwd: string;

                                                property filepath

                                                filepath: string;

                                                  property profiler

                                                  profiler: Profiler;

                                                    property profilerOutput

                                                    profilerOutput?: string;

                                                      method enableCheckMode

                                                      enableCheckMode: () => void;

                                                        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, 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;
                                                                                    emitLegacyCommonJSImports?: boolean;
                                                                                    };

                                                                                      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>