-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.ts
36 lines (32 loc) · 935 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
import type { CodegenConfig } from '@graphql-codegen/cli'
import config from './config'
const eslintDisableContent = `
/** THIS FILE IS AUTO-GENERATED **/
/** DO NOT EDIT **/
/* eslint-disable */
`
const codegenConfig: CodegenConfig = {
overwrite: true,
schema: `${config.apiUrl}/graphql`,
documents: './schemas/*.ts',
ignoreNoDocuments: true,
hooks: { afterAllFileWrite: ['prettier --write'] },
generates: {
'./schemas/__generated__/types.ts': {
plugins: [{ add: { content: eslintDisableContent } }, 'typescript']
},
'./schemas/__generated__/': {
preset: 'near-operation-file',
presetConfig: {
baseTypesPath: 'types.ts',
folder: '__generated__'
},
plugins: [{ add: { content: eslintDisableContent } }, 'typescript-operations'],
config: {
useTypeImports: true,
preResolveTypes: false
}
}
}
}
export default codegenConfig