Skip to content

HunterLarco/graphql-buddy

Repository files navigation

graphql-buddy

npm version CI

CLI tools for manipulating graphql // designed for build system tooling.

Includes useful tools like:

  • bundle ~ merge multiple schema's into one (wth tree shaking).
  • validate ~ validate GraphQL schema.

Necessary for build tool integrations such as rules_graphql.

Table of Contents

Quick Start

npm install graphql-buddy

npx graphql-buddy bundle **/*.graphql

Documentation

You can always use graphql-buddy --help for CLI documentation.

Bundle

Bundles multiple schema into a single file and prunes any unused types from the bundle.

For example:

npx graphql-buddy bundle **/*.graphql

# If you want to preserve unused types.
npx graphql-buddy bundle **/*.graphql --no-shake

Validate

Validates schema, ensuring valid syntax and that all symbols are found.

For example:

npx graphql-buddy validate **/*.graphql

For many build systems (such as BUCK and BAZEL) all build steps must emit a file. Validate accomodates this by writing "validation stamps", a file only written if validation is successful and documents the exact settings used during validation. For example:

npx graphql-buddy validate **/*.graphql --stamp schema.stamp

Programmatic Use

All commands and most helpers are available programmatically.

import * as graphqlBuddy from 'graphql-buddy';

await graphqlBuddy.bundle({ ... });
await graphqlBuddy.validate({ ... });

Contributions

Contributions, issues and feature requests are very welcome. If you are using this package and fixed a bug for yourself, please consider submitting a PR!

About

CLI tools for manipulating graphql // designed for build system tooling

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published