graphql-config
The easiest way to configure your development environment with your GraphQL schema (supported by most tools, editors & IDEs)
Last updated 5 years ago by kamilkisiela .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install graphql-config 
SYNC missed versions from official npm registry.

GraphQL Config

GraphQL Config

The easiest way to configure your development environment with your GraphQL schema (supported by most tools, editors & IDEs).

GraphQL Config file

schema: ./schema.json
documents: ./src/components/**/*.jsx

Usage

Install:

  yarn add graphql-config
  npm install graphql-config

Use:

Very basic outline in TypeScript:

import {loadConfig} from 'graphql-config';

async function main() {
  const config = await loadConfig({...});

  const schema = await config.getDefault().getSchema();
}

The ... expression in the loadConfig function is a placeholder for a LoadConfigOptions object; leaving this space empty will pass defaults.

Here is a more robust, working example using a generate extension from the GraphQL CLI Backend Template:

const config = await loadConfig({
    extensions: [() => ({ name: 'generate'})]
});

const generateConfig = await config!.getDefault().extension('generate');

...
  
const schema = makeExecutableSchema({
    typeDefs,
    resolvers
});

Help & Community Discord Chat

Join our Discord chat if you run into issues or have questions. We love talking to you!

Current Tags

  • 5.0.3-alpha-20231010191015-9adcd64                                ...           alpha (a year ago)
  • 0.0.0-experimental-41adb5d.119                                ...           canary (3 years ago)
  • 0.0.0-experimental.0                                ...           experimental (5 years ago)
  • 3.0.0-alpha.13                                ...           guild (5 years ago)
  • 5.1.3                                ...           latest (3 months ago)
  • 3.0.0-rc.3                                ...           next (5 years ago)

320 Versions


© 2010 - cnpmjs.org x YWFE | Home | YWFE