Skip to content

Commit 93ea62a

Browse files
committed
Add GraphQL infrastructure
Adds an API for GraphQL requests, and a build script to autogenerate TS types from a GraphQL schema + GraphQL queries. The most commonly used GraphQL client seems to be Apollo, but I'm not convinced it's not overkill for this usecase. In order to keep the dependencies lightweight but also keep our options open in the future, I've instead written a simple shim compatible with the codegen intended for Apollo but not actually using Apollo as a dependency. Since the GraphQL API doesn't get called yet, this PR is fully backwards compatible.
1 parent 3b6fd10 commit 93ea62a

File tree

7 files changed

+15715
-7296
lines changed

7 files changed

+15715
-7296
lines changed

codegen.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { CodegenConfig } from "@graphql-codegen/cli";
2+
3+
const config: CodegenConfig = {
4+
overwrite: true,
5+
schema: "schema.graphql",
6+
documents: "src/**/*.graphql",
7+
generates: {
8+
"src/generated/graphql.ts": {
9+
plugins: ["typescript", "typescript-operations", "typescript-apollo-angular"],
10+
config: {
11+
gqlImport: "app/util/services/graphql#gql",
12+
apolloAngularPackage: "app/util/services/graphql"
13+
}
14+
}
15+
}
16+
};
17+
18+
export default config;

0 commit comments

Comments
 (0)