-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodegen.ts
40 lines (38 loc) · 1.2 KB
/
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
import { type CodegenConfig } from '@graphql-codegen/cli'
const config: CodegenConfig = {
overwrite: true,
schema: ['https://rickandmortyapi.com/graphql', 'schema-extensions.gql'],
generates: {
'schema.gql': {
plugins: ['schema-ast'],
config: { includeDirectives: true }
},
'src/types/generated.ts': {
documents: ['src/**/*.graphql', 'src/**/*.gql', 'src/**/*.vue'],
plugins: [
{ add: { content: '/* eslint-disable */' } },
'typescript',
'typescript-operations'
],
hooks: { afterOneFileWrite: ['pnpm exec prettier --write src/types/generated.ts'] }
},
'src/graphql/operations.ts': {
documents: ['src/**/*.graphql', 'src/**/*.gql', 'src/**/*.vue'],
plugins: [
{
add: {
content: ['/* eslint-disable */', "import * as Generated from '@/types/generated';"]
}
},
'typescript-vue-apollo'
],
config: {
withCompositionFunctions: true,
vueCompositionApiImportFrom: 'vue',
importOperationTypesFrom: 'Generated'
},
hooks: { afterOneFileWrite: ['pnpm exec prettier --write src/graphql/operations.ts'] }
}
}
}
export default config