-
Notifications
You must be signed in to change notification settings - Fork 1
/
codegen.ts
43 lines (39 loc) · 915 Bytes
/
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import dotenv from 'dotenv';
import { CodegenConfig } from '@graphql-codegen/cli';
dotenv.config();
const endpoint = `${process.env.AWS_APPSYNC_ENDPOINT}`;
const config: CodegenConfig = {
schema: [
{
[endpoint]: {
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.AWS_APPSYNC_KEY ?? '',
},
},
},
],
documents: ['src/**/*.graphql'],
generates: {
'src/graphql/generated.ts': {
plugins: [
'typescript',
'typescript-operations',
'typescript-document-nodes',
],
config: {
nameSuffix: 'Document',
scalars: {
AWSDateTime: 'string',
AWSEmail: 'string',
AWSURL: 'string',
AWSTimestamp: 'number',
},
},
},
},
hooks: {
afterOneFileWrite: ['prettier --write --ignore-unknown'],
},
};
export default config;