Codegen

Creates a typed gqless client from a graphql endpoint.

Command

$ gqless generate [OUTPUT_DIR]

Options

OptionAliasTypeDefaultDescription
--config-cstringPath to your gqless config file.
--help-hShow CLI help.
--typescript-tbooleantrueOutput TypeScript (instead of JavaScript).
--url-ustringURL to the GraphQL endpoint.
--commentsbooleantrueOutput comments to type definitions (useful for IDE intellisense).
--headerstringAdditional header to send to server for introspectionQuery.
May be used multiple times to add multiple headers.

Examples

$ gqless generate ./src/gqless -u https://example.com/graphql
$ gqless generate -c gqless.config.ts

Format output code

CLI code generator comes with built in support for formatting code using Prettier. The config search will start at the output directory and will continue up the directories tree.

Last updated on by Łukasz Jagodziński