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

Graphql-tag Schema

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

The .ts or .js 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-schema

Examples

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

Result

import gql from 'graphql-tag'

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

export default schema

Current Tags

  • 1.0.5                                ...           latest (6 months ago)

6 Versions

  • 1.0.5                                ...           6 months ago
  • 1.0.4                                ...           6 months ago
  • 1.0.3                                ...           6 months ago
  • 1.0.2                                ...           6 months ago
  • 1.0.1                                ...           6 months ago
  • 1.0.0                                ...           6 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |