-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
graphql.config.ts
42 lines (40 loc) · 1.04 KB
/
graphql.config.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Import env variables
require( 'dotenv' ).config(); // eslint-disable-line @typescript-eslint/no-var-requires
import { getGraphqlEndpoint } from '@faustwp/core';
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: [
{
[ `${ getGraphqlEndpoint() }` ]: {
headers: {
Origin: process.env.NEXT_PUBLIC_SITE_URL, // Required to limit authorized domains.
},
},
},
],
// match any tsx file in the src directory no matter how deep
documents: [ './src/**/*.{tsx,ts}', '!./src/__generated__/**/*' ],
generates: {
'./src/__generated__/': {
preset: 'client',
presetConfig: {
gqlTagName: 'gql',
fragmentMasking: false,
},
config: {
reactApolloVersion: 3,
declarationKind: {
union: 'type',
interface: 'interface',
},
withRefretchFn: true,
useImplementingTypes: true,
dedupeFragments: true,
optimizeDocumentNode: true,
flattenGeneratedTypes: true,
flattenGeneratedTypesIncludeFragments: true,
},
},
},
};
export default config;