1.1.1 • Published 2 years ago

@bond-london/gatsby-graphql-typegen v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@bond-london/gatsby-graphql-typegen

Plugin to generate graphql types for Gatsby.

It uses the same approach as the core graphqlTypegen but provides a few more options

Installation

yarn add @bond-london/gatsby-graphql-typegen

Configuration

Add to your gatsby-config.ts and configure it as shown below.

    {
      resolve: "@bond-london/gatsby-graphql-typegen",
      options: {
        gatsbyTypesFile: "gatsby-types.d.ts",
        configOptions: {
          skipTypename: false,
        },
      },
    },

If you specify the gatsbyTypesFile make sure that the tsconfig.json file correctly picks it up.

Configuration options

KeyTypeDescription
gatsbyTypesFilesStringThe name of the types file. This is useful if you use tailwind and don't want to generate in the src directory
configOptionsObjectAdditional configuration options. See https://www.graphql-code-generator.com/plugins/typescript for details
additionalTypescriptFilesString[]Additional files to read queries from in addition to the defaults. ./gatsby-node.ts,./plugins/**/gatsby-node.ts