The Guild LogoThe Guild Monogram
Docs

KitQL Docs

A set of tools, helping you building efficient apps in a fast way.

Documentation

⚡How to - graphql-codegen#

yarn add -D @kitql/graphql-codegen

Steps#

  1. Create a .graphqlrc.yaml at the root of your application (Like in the Demo 1)
# ... codegen: generates: ./src/lib/modules/: preset: graphql-modules presetConfig: baseTypesPath: ../graphql/_kitql/graphqlTypes.ts importBaseTypesFrom: $lib/graphql/_kitql/graphqlTypes filename: _kitql/moduleTypes.ts plugins: - typescript - typescript-resolvers - typescript-operations - typed-document-node config: contextType: $lib/graphql/yogaApp#IYogaContext ./src/lib/graphql/_kitql/graphqlStores.ts: plugins: - '@kitql/graphql-codegen' config: importBaseTypesFrom: $lib/graphql/_kitql/graphqlTypes config: useTypeImports: true # ...
  1. Create a script gen in your package.json like:
"scripts": { "gen": "graphql-codegen --config ./.graphqlrc.yaml", },
  1. run code gen
yarn gen
  1. Setup vite-plugin-watch-and-run to run gen everytime you change a GraphQL file. ⚡⚡⚡