Skip to content

Commit

Permalink
Add GraphQL infrastructure
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lcdr committed Jun 16, 2024
1 parent 3b6fd10 commit 93ea62a
Show file tree
Hide file tree
Showing 7 changed files with 15,715 additions and 7,296 deletions.
18 changes: 18 additions & 0 deletions codegen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
overwrite: true,
schema: "schema.graphql",
documents: "src/**/*.graphql",
generates: {
"src/generated/graphql.ts": {
plugins: ["typescript", "typescript-operations", "typescript-apollo-angular"],
config: {
gqlImport: "app/util/services/graphql#gql",
apolloAngularPackage: "app/util/services/graphql"
}
}
}
};

export default config;
Loading

0 comments on commit 93ea62a

Please sign in to comment.