-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodegen.ts
More file actions
43 lines (38 loc) · 1.14 KB
/
Copy pathcodegen.ts
File metadata and controls
43 lines (38 loc) · 1.14 KB
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
43
// codegen.ts
import { maybeDependOnExistenceOfEntity } from '@apollo/client/cache/inmemory/entityStore';
import type { CodegenConfig } from '@graphql-codegen/cli';
import * as dotenv from 'dotenv';
dotenv.config();
const API_URL = process.env.API_URL;
const schema: CodegenConfig['schema'] = API_URL
? [{ [API_URL]: { headers: {} } }]
: './graphql-schema.json';
const config: CodegenConfig = {
schema,
// uniquement tes documents d'opérations
documents: ['app/gql/**/*.{gql,graphql}'],
generates: {
'app/types/gql.ts': {
plugins: ['typescript', 'typescript-operations'],
config: {
withHooks: true,
avoidOptionals: false,
useTypeImports: true,
gqlTagName: 'gql',
gqlImport: 'graphql-tag',
skipTypename: true,
omitOperationSuffix: true,
maybeValue: 'T | null',
arrayInputCoercion: false,
wrapList: true,
inputMaybeValue: 'T | null',
namingConvention: {
typeNames: 'change-case#pascalCase',
enumValues: 'change-case#pascalCase',
},
},
},
},
ignoreNoDocuments: false,
};
export default config;