-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodegen.ts
More file actions
30 lines (27 loc) · 716 Bytes
/
codegen.ts
File metadata and controls
30 lines (27 loc) · 716 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
import { CodegenConfig } from '@graphql-codegen/cli';
import * as dotenv from 'dotenv';
dotenv.config();
const config: CodegenConfig = {
schema: [
{
[`https://graphql.contentful.com/content/v1/spaces/${process.env.CONTENTFUL_SPACE_ID}`]: {
headers: {
Authorization: `Bearer ${process.env.CONTENTFUL_ACCESS_TOKEN}`,
},
},
},
],
documents: ['src/**/*.graphql'],
generates: {
'src/lib/contentful/generated/graphql.ts': {
plugins: ['typescript', 'typescript-operations'],
config: {
skipTypename: false,
enumsAsTypes: true,
dedupeFragments: true,
avoidOptionals: true,
},
},
},
};
export default config;