-
Notifications
You must be signed in to change notification settings - Fork 0
/
graphql-codegen.ts
26 lines (24 loc) · 979 Bytes
/
graphql-codegen.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
schema: "https://whiteboardtalks.com/graphql", // Your WordPress GraphQL API endpoint
documents: ["src/**/*.graphql"], // Include queries from .graphql files
generates: {
// This will generate GraphQL queries, mutations, and subscriptions as JS code
"./src/__generated__/": {
preset: "client",
presetConfig: {
gqlTagName: "gql", // You can adjust the tag name as needed
},
},
// This will generate types for your GraphQL operations and Apollo
"./src/__generated__/types.ts": {
plugins: [
"typescript", // Generate TypeScript types
"typescript-operations", // Generate types for operations (queries, mutations)
"typescript-react-apollo", // Add Apollo-specific types
],
},
},
ignoreNoDocuments: true, // Ignore errors if no queries are found in documents
};
export default config;