graphql-tag-typescript-schema
GraphQL Code Generator plugin for generating a .ts file from a given schema
Last updated a year ago by emolr .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install graphql-tag-typescript-schema 
SYNC missed versions from official npm registry.

Graphql-tag Typescript Schema

graphql-tag-typescript-schema plugin prints the merged schema as graphql-tag in a .ts to be used with eg. Apollo Client. If multiple schemas are provided, they will be merged and printed as one schema.

The .ts file exposes a JavaScript template literal tag that parses GraphQL query strings into the standard GraphQL AST. Make sure to have graphql-tag installed in the application you are using the output.

Installation

$ yarn add -D graphql-tag-typescript-schema

Examples

# ...
schema:
  - 'http://localhost:3000/graphql'
  - './src/**/*.graphql'
generates:
  path/to/file.ts:
    plugins:
      - graphql-tag-typescript-schema

Result

import gql from 'graphql-tag'

export const schema = gql`
    type ExampleType {
        example: Boolean!
    }
`

export default schema

Current Tags

  • 1.0.2                                ...           latest (a year ago)

3 Versions

  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |