gql-queries-generator

Autogenerate simplest client queries from graphql types. For example:


Keywords
graphql, graphqltype
License
ISC
Install
npm install gql-queries-generator@1.1.2

Documentation

gql-queries-autogenerator

Autogenerate simplest client queries from graphql types. For example:

type MessageSubType{
  author: String!,
  value: String!
}

converts to

export const messageSubType = gql`
    query MessageSubType {
        author,
        value
    }
`;

Using:

cli

node index.js targetFile.js

programming:

const createQueries = require('gql-queries-generator').createQueries;
// or `import {createQueries} from 'gql-queries-generator';`
createQueries('d.js', {template: './template.js'})

Installation:

npm i -D gql-queries-generator