-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodegen.ts
More file actions
34 lines (32 loc) · 831 Bytes
/
codegen.ts
File metadata and controls
34 lines (32 loc) · 831 Bytes
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
import type { CodegenConfig } from '@graphql-codegen/cli';
import dotenv from 'dotenv';
// Load environment variables from .env file
dotenv.config();
const config: CodegenConfig = {
hooks: { afterAllFileWrite: ['prettier --write'] },
schema: [
{
[process.env.NEXT_PUBLIC_HASURA_GRAPHQL_URL as string]: {
headers: {
'x-hasura-role': process.env.HASURA_GRAPHQL_ADMIN_ROLE as string,
'x-hasura-admin-secret': process.env
.HASURA_GRAPHQL_ADMIN_SECRET as string,
},
},
},
],
documents: ['src/**/*.tsx', 'src/**/*.ts'],
generates: {
'./src/types/': {
preset: 'client',
config: {
scalars: {
bigint: 'number',
numeric: 'number',
jsonb: 'unknown',
},
},
},
},
};
export default config;