1.1.0 • Published 5 years ago

node-graphql-import v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Build Status GitHub npm Coverage Status

node-graphql-import

Installation

npm install --save react-testing-library
yarn add react-testing-library

Details

imports .graphql or .gql files from folder and convert them into graphql tag.

Options

filesPath - path to folder

fileTag - part of filename // only files containing the fileTag in the name will be imported (.ie fileTag TYPE imports only UserTYPE.graphql, PostTYPE.graphql etc, PostENUM.graphql will not be imported )

Example

example file structure
|root
--|schema
    --Mutation.graphql
    --Query.graphql
----|type
    --UserTYPE.graphql
----|input
    --UserINPUT.graphql
----|enum
    --UserStatusENUM.graphql
----|custom
    --UserCUSTOM.graphql
import path from "path";
import SchemaRequire from "node-graphql-import";
import { ApolloServer } from "apollo-server-express";

const RootSchema = SchemaRequire({ filesPath: path.join(__dirname,"./schema") });
const TypeSchema = SchemaRequire({ filesPath: path.join(__dirname,"./schema/type") });
const InputSchema = SchemaRequire({ filesPath: path.join(__dirname,"./schema/input") });
const EnumSchema = SchemaRequire({ filesPath: path.join(__dirname,"./schema/enum") });
const CustomSchema = SchemaRequire({ filesPath: path.join(__dirname,"./schema/custom"), "CUSTOM"});

const server = new ApolloServer({
  typeDefs: [RootSchema, TypeSchema,InputSchema, EnumSchema],
  resolvers,
});
1.1.0

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago