Skip to content
One configuration for all your GraphQL tools (supported by most tools, editors & IDEs)
TypeScript JavaScript CSS HTML
Branch: master
Clone or download

Latest commit

dependabot-preview chore(deps-dev): bump tslib from 1.11.0 to 1.11.1 (#418)
Bumps [tslib](https://github.com/Microsoft/tslib) from 1.11.0 to 1.11.1.
- [Release notes](https://github.com/Microsoft/tslib/releases)
- [Commits](microsoft/tslib@1.11.0...1.11.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Latest commit b6f4a80 Feb 28, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Fix Node8 issue with RegExp and update dependencies to latest (#257) Jan 16, 2020
.vscode New GraphQL Config (#162) Oct 24, 2019
docs Add support for advanced default values for environment variables (#247) Nov 12, 2019
resources reworked format Aug 4, 2016
src Fix Node8 issue with RegExp and update dependencies to latest (#257) Jan 16, 2020
test Fix Node8 issue with RegExp and update dependencies to latest (#257) Jan 16, 2020
tests New GraphQL Config (#162) Oct 24, 2019
website Website (#186) Oct 25, 2019
.eslintrc New GraphQL Config (#162) Oct 24, 2019
.gitignore Website (#186) Oct 25, 2019
.prettierrc Clean up repository (#139) Sep 26, 2019
.yarnrc New GraphQL Config (#162) Oct 24, 2019
LICENSE Initial commit Jul 29, 2016
README.md Clarify use section in readme (#212) Nov 4, 2019
jest.config.js New GraphQL Config (#162) Oct 24, 2019
now.json Website (#186) Oct 25, 2019
package.json chore(deps-dev): bump tslib from 1.11.0 to 1.11.1 (#418) Feb 27, 2020
tsconfig.json v3.0.0-alpha.18 (#319) Jan 16, 2020
tsconfig.test.json New GraphQL Config (#162) Oct 24, 2019
yarn.lock chore(deps-dev): bump tslib from 1.11.0 to 1.11.1 (#418) Feb 27, 2020

README.md

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!

You can’t perform that action at this time.