57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
|
|
import type { CodegenConfig } from '@graphql-codegen/cli'
|
||
|
|
|
||
|
|
const config: CodegenConfig = {
|
||
|
|
overwrite: true,
|
||
|
|
// Используем только core схему для основной генерации
|
||
|
|
schema: 'http://localhost:8000/graphql',
|
||
|
|
documents: ['panel/graphql/queries/**/*.ts', 'panel/**/*.{ts,tsx}', '!panel/graphql/generated/**'],
|
||
|
|
generates: {
|
||
|
|
'./panel/graphql/generated/introspection.json': {
|
||
|
|
plugins: ['introspection'],
|
||
|
|
config: {
|
||
|
|
minify: true
|
||
|
|
}
|
||
|
|
},
|
||
|
|
'./panel/graphql/generated/schema.graphql': {
|
||
|
|
plugins: ['schema-ast'],
|
||
|
|
config: {
|
||
|
|
includeDirectives: false
|
||
|
|
}
|
||
|
|
},
|
||
|
|
'./panel/graphql/generated/': {
|
||
|
|
preset: 'client',
|
||
|
|
plugins: [],
|
||
|
|
presetConfig: {
|
||
|
|
gqlTagName: 'gql',
|
||
|
|
fragmentMasking: false
|
||
|
|
},
|
||
|
|
config: {
|
||
|
|
scalars: {
|
||
|
|
DateTime: 'string',
|
||
|
|
JSON: 'Record<string, any>'
|
||
|
|
},
|
||
|
|
// Настройки для правильной работы
|
||
|
|
skipTypename: false,
|
||
|
|
useTypeImports: true,
|
||
|
|
dedupeOperationSuffix: true,
|
||
|
|
dedupeFragments: true,
|
||
|
|
// Избегаем конфликтов при объединении
|
||
|
|
avoidOptionals: false,
|
||
|
|
enumsAsTypes: false
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// Глобальные настройки для правильной работы
|
||
|
|
config: {
|
||
|
|
skipTypename: false,
|
||
|
|
useTypeImports: true,
|
||
|
|
dedupeOperationSuffix: true,
|
||
|
|
dedupeFragments: true,
|
||
|
|
// Настройки для объединения схем
|
||
|
|
avoidOptionals: false,
|
||
|
|
enumsAsTypes: false
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export default config
|