Skip to content
This repository has been archived by the owner on Dec 28, 2019. It is now read-only.

lewisf/extract-gql

Repository files navigation

extract-gql

A utility for extracting graphql documents from multiple files into a single string.

Setup

This isn't published yet ... clone and use npm link or install it from a file path.

Usage

import { ExtractGQL } from 'extract-gql';

const extractor = new ExtractGQL();
const queryDocument = extractor.fromFiles([
  'path/to/oneQuery.graphl',
  'path/to/sourceFileWithEmbeddedGraphQL.js',
]);

If you have graphql documents embedded within your source files and use a template tag other than gql, then make sure to initialize your extractor accordingly.

const extractor = new ExtractGQL({ templateTag: 'MyTag' });

API

  • ExtractGQL#constructor (options: { templateTag: string }) => void
  • ExtractGQL#fromFiles (filePaths: string) => string
  • ExtractGQL#fromFile (filePath: string) => string
  • ExtractGQL#fromJS (filePath: string) => string
  • ExtractGQL#fromGraphQL (filePath: string) => string

`

More to come!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published