A CLI tool for checking whether one GraphQL schema is backwards compatible with another.
npm install -g @equiem/gql-compat
gql-compat --help
npm install --save-dev @equiem/gql-compat
Then in package.json
add:
{
"scripts": {
"script-name": "gql-compat [options]"
}
}
Compare schema in master against schema in current working copy.
$ gql-compat check 'origin/master:path/to/*/*.graphql' 'path/to/*/*.graphql'
Append all current breaking changes to the ignore file: .gql-compat-ignore
.
$ gql-compat ignore 'origin/master:path/to/*/*.graphql' 'path/to/*/*.graphql'
Now all current breaking changes will be ignored for a period of time (the --ignore-tolerance
period, which defaults to 7 days).
There is a difference between glob matching for the working copy vs. the contents of a committish. The former uses a glob match, whereas the latter uses the pattern matching of git ls-files.