graphql-codegen-prisma-binding

$ npm install -g graphql-codegen-binding $ graphql-codegen-binding

Usage no npm install needed!

<script type="module">
  import graphqlCodegenPrismaBinding from 'https://cdn.skypack.dev/graphql-codegen-prisma-binding';
</script>

README

graphql-codegen-binding

Usage

CLI

$ npm install -g graphql-codegen-binding
$ graphql-codegen-binding

Usage: graphql-codegen-binding -s [schema] -e [endpoint] -h [headers] -g [generator] -t [target]

Options:
  --help           Show help                                           [boolean]
  --version        Show version number                                 [boolean]
  --schema, -s     Path to schema.graphql file                          [string]
  --endpoint, -e   GraphQL endpoint to fetch schema from                [string]
  --headers, -h    Header to use for downloading the schema (with endpoint URL)
                                                                        [string]
  --generator, -g  Type of the generator. Available generators: typescript,
                   javascript                                [string] [required]
  --target, -t     Target file. Example: schema.ts           [string] [required]

Typescript

import { generateCode } from 'graphql-codegen-binding'
import * as fs from 'fs'

const code = generateCode(fs.readFileSync('schema.graphql'), 'typescript')

fs.writeFileSync('MyBinding.ts', code)