Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-document-collector

Package Overview
Dependencies
Maintainers
4
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-document-collector

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

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26K
decreased by-16.18%
Maintainers
4
Weekly downloads
 
Created
Source

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.

Keywords

FAQs

Package last updated on 01 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc