-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathcodegen.ts
More file actions
44 lines (42 loc) · 1.1 KB
/
codegen.ts
File metadata and controls
44 lines (42 loc) · 1.1 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
44
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: {
[process.env.NEXT_PUBLIC_HASURA_GRAPHQL_URL || 'http://localhost:8080/v1/graphql']: {
headers: {
'x-hasura-admin-secret': process.env.NEXT_PUBLIC_HASURA_ADMIN_SECRET || 'safetrust_admin_secret_2024',
},
},
},
documents: [
'src/graphql/**/*.{ts,tsx,graphql,gql}',
'src/components/**/*.{ts,tsx}',
'src/app/**/*.{ts,tsx}',
],
generates: {
'./src/graphql/generated/': {
preset: 'client',
config: {
useTypeImports: true,
defaultScalarType: 'unknown',
strictScalars: true,
scalars: {
UUID: 'string',
timestamptz: 'string',
jsonb: 'Record<string, any>',
numeric: 'number',
},
},
plugins: [],
},
'./src/graphql/generated/introspection.json': {
plugins: ['introspection'],
},
'./src/graphql/generated/schema.graphql': {
plugins: ['schema-ast'],
},
},
hooks: {
afterAllFileWrite: ['prettier --write'],
},
};
export default config;