8000 GitHub - armstrjare/graphql-document-collector: 📑 Load up smartly, in one location, all of the GraphQL queries/mutations/subscriptions of your project
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

armstrjare/graphql-document-collector

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graphql-document-collector

Load up smartly, in one location, all of the GraphQL queries/mutations/subscriptions of your project

npm version Get on Slack

Installation

npm i -g graphql-document-collector

Usage

graphql-document-collector has a straightforward CLI interface to precompile all of your GraphQL documents in one definition file:

graphql-document-collector '$glob' > $dest

Example

Collect all .graphql files of your project in a single documents.json definition file:

graphql-document-collector '**/*.graphql' > documents.json

This can be exploited afterwards like this:

// Note: if you are using webpack, you will need to setup a 'json-loader'
const graphqlDocs = require('./documents.json');

// You can use any client able to read some graphql document AST
apolloClient.query({query: graphqlDocs['queries/ListMovies.graphql']})
.then(({data}) => {/* ... */});

Note: you don't have to worry about loading fragments, they are already resolved in the document.

About

📑 Load up smartly, in one location, all of the GraphQL queries/mutations/subscriptions of your project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.0%
  • JavaScript 2.0%
0