Install
yarn add @kickstarter/binding
Setup
Create a .bind-graphqlrc
or bind-graphql.config.js
that exports the following options
schema: string
Relative path or URL to GraphQL schema (default: "./schema.graphql")
output: string
Relative path of output schema declaration file (default: "./schema.d.ts")
files: string
Glob for GraphQL files to compile (default: "**/*.graphql")
print: boolean
Do not write schema file, and instead print the result (default: false)
Use
Use @kickstarter/binding/graphql-webpack-loader
as your Webpack loader for GraphQL files.
Use @kickstarter/binding/graphql-jest-transform
as your Jest transform for GraphQL files.
Run yarn bind-graphql
to create type definitions for all GraphQL files.
Import .graphql
files directly into your TypeScript file.
Generated code
TODO