Adopt graphql-code-generator
Created by: felixfbecker
This is extended from a subset of https://github.com/sourcegraph/sourcegraph/pull/12284.
It includes:
- Migration to graphql-code-generator from our copy-pasted, buggy generator.
- Change to
requestGraphQL()
et al to allow them to make use of query types in our application. - Addition to graphql-code-generator to our Gulp scripts (and dev/start), including watch mode. It uses its native watch mode.
- Unique names for all fragments.
- Docs on how to use the new types (and the preferred way to interact with GraphQL in general), including notes on the "older" types.
- Gitignoring graphql-operations.ts
- Also generating types for the browser extension, not just shared/ and web/
It does not include:
- Refactors of our app away from
gql2ts
schema-based types. It showed value (I noticed bugs through the higher type safety) but it is a lot more effort. - Removal of
gql2ts
, or generating the schema-based types also with graphql-code-genarator. They have slight differences, so this would be more effort, and it makes more sense to jump directly to query-based types when refactoring.