https://github.com/fabien0102/graphql-codegen-binding
https://github.com/fabien0102/graphql-codegen-binding
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fabien0102/graphql-codegen-binding
- Owner: fabien0102
- Created: 2018-04-16T14:55:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-16T15:18:17.000Z (over 7 years ago)
- Last Synced: 2025-03-20T03:01:57.230Z (7 months ago)
- Language: TypeScript
- Size: 97.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# graphql-codegen-binding
## Usage
### CLI
```sh
$ npm install -g graphql-codegen-binding
$ graphql-codegen-bindingUsage: 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
```ts
import { generateCode } from 'graphql-codegen-binding'
import * as fs from 'fs'const code = generateCode(fs.readFileSync('schema.graphql'), 'typescript')
fs.writeFileSync('MyBinding.ts', code)
```