-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.ts
44 lines (41 loc) · 928 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
44
import type { CodegenConfig } from '@graphql-codegen/cli'
import { loadEnvConfig } from '@next/env'
loadEnvConfig(process.cwd())
const config: CodegenConfig = {
overwrite: true,
schema: process.env.NEXT_PUBLIC_GRAPH_API_URL,
documents: 'src/**/*.gql',
generates: {
'src/lib/gql/type.generated.ts': {
plugins: ['typescript'],
config: {
scalars: {
ID: 'number',
Timestamp: 'string',
},
},
},
'src/lib/gql/': {
preset: 'near-operation-file',
plugins: [
'typescript-operations',
{
'typescript-urql': {},
},
],
config: {
scalars: {
ID: 'number',
Timestamp: 'string',
},
},
presetConfig: {
baseTypesPath: 'type.generated.ts',
},
},
'./graphql.schema.json': {
plugins: ['introspection'],
},
},
}
export default config