Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @wheelroom/wheelroom-plugin-graphql with all npm packages installed. Try it out:

var wheelroomPluginGraphql = require("@wheelroom/wheelroom-plugin-graphql")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@wheelroom/wheelroom-plugin-graphql v3.1.12

Site framework based on Contentful and Gatsby

@wheelroom/wheelroom-plugin-graphql

This is a plugin for the @wheelroom/wheelroom package.

Have a look at the boilerplate to so see how to use this.

Commands

This plugin adds the create-graphql command which lets you create boilerplate graphql. Intended use is generating files for Gatsbyjs, a static site generator.

wheelroom create-graphql <template-set> <path> [options]

Config

The plugin is configured by adding it to wheelroom-config.js

var templateSets = require('./wheelroom-template-sets')

module.exports = {
  components: {
      ...
  },
  plugins: [
    {
      resolve: '@wheelroom/wheelroom-plugin-graphql',
      options: {
        templateSets: templateSets,
      },
    },
  ],
}

Template sets

Using typescript, template sets are defined like this.

import { TemplateSets } from '@wheelroom/wheelroom-plugin-graphql'
import { fragment } from './fragment'
import { query } from './query'

export const templateSets: TemplateSets = {
  gatsbyjs: {
    fragment: {
      filterComponentSetting: 'asFragment',
      path: '%component-name%-fragment.js',
      template: fragment,
    },
    query: {
      filterComponentSetting: 'asQuery',
      path: '%component-name%-query.js',
      template: query,
    },
  },
}
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free