/graphql-cli

🔪🥒 Swiss Army Knife for your GraphQL Project

Primary LanguageTypeScriptMIT LicenseMIT

graphql-cli

🔪🥒 Swiss Army Knife for your GraphQL Project

Features

  • Helpful commands to improve your workflows like get-schema, diff & playground
  • Compatible with editors and IDEs based on graphql-config
  • Powerful plugin system to extend graphql-cli with custom commands

You can see it in action here:

demo

Install

You can simply install the CLI using npm or yarn by running the following command. This will add the graphql (and shorter gql) binary to your path.

npm install -g graphql-cli

Usage

Usage: graphql [command]

Commands:
  init                   Initial config setup
  add-endpoint           Add new endpoint to .graphqlconfig
  get-schema [endpoint]  Download schema from endpoint
  schema-status          Show source and timestamp of the local schema file
  ping [endpointName]    Ping GraphQL endpoint
  diff <from> [to]       Show a diff between two schemas
  playground [endpoint]  Open interactive GraphQL Playground

Options:
  --help  Show help                                                    [boolean]

Examples:
  graphql init            Interactively setup .graphqlconfig file
  graphql get-schema dev  Update local schema to match "dev" endpoint
  graphql diff dev prod   Show schema diff between "dev" and "prod" endpoints

For more information go to https://github.com/graphcool/graphcool-cli

Initial setup and schema download

Listen to schema changes

Autocompletion setup

To install autocompletion in your terminal run

graphql completion >> ~/.bashrc

or on OSX

graphql completion >> ~/.bash_profile

Plugins

Do you want to create your own plugin? Here is a simple example.

Contributors

A big thank you to all contributors and supporters of this repository 💚

IvanGoncharov RomanGotsiy schickling

Help & Community Slack Status

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