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.
npm install graphql-buddy
npx graphql-buddy bundle **/*.graphql
You can always use graphql-buddy --help for CLI documentation.
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-shakeValidates 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.stamp
All commands and most helpers are available programmatically.
import * as graphqlBuddy from 'graphql-buddy';
await graphqlBuddy.bundle({ ... });
await graphqlBuddy.validate({ ... });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!