generated from React-Avancado/boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodegen.ts
45 lines (43 loc) · 1.28 KB
/
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
44
45
import { type CodegenConfig } from '@graphql-codegen/cli';
import {
URLResolver,
JWTResolver,
UUIDResolver,
DateTimeResolver,
DateTimeISOResolver,
EmailAddressResolver,
} from 'graphql-scalars';
const config: CodegenConfig = {
documents: ['./src/graphql/**/*.ts'],
schema: 'http://localhost:3000/graphql',
generates: {
'./src/graphql/generated/schema.json': {
plugins: ['introspection'],
},
'./src/graphql/generated/index.ts': {
hooks: { afterOneFileWrite: 'eslint --fix' },
plugins: [
'typescript',
'typescript-operations',
'typescript-react-apollo',
],
config: {
withHOC: false,
withHooks: true,
reactApolloVersion: 3,
withComponents: false,
scalars: {
Upload: 'File',
JWT: JWTResolver.extensions.codegenScalarType,
ID: UUIDResolver.extensions.codegenScalarType,
URL: URLResolver.extensions.codegenScalarType,
UUID: UUIDResolver.extensions.codegenScalarType,
DateTime: DateTimeResolver.extensions.codegenScalarType,
DateTimeISO: DateTimeISOResolver.extensions.codegenScalarType,
EmailAddress: EmailAddressResolver.extensions.codegenScalarType,
},
},
},
},
};
export default config;