graphql-buddy
v0.0.0
Published
CLI tools for manipulating graphql // designed for build system tooling
Maintainers
Readme
graphql-buddy
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 **/*.graphqlDocumentation
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-shakeValidate
Validates schema, ensuring valid syntax and that all symbols are found.
For example:
npx graphql-buddy validate **/*.graphqlFor 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.stampProgrammatic 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!
