-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodegen.ts
More file actions
28 lines (25 loc) · 1020 Bytes
/
Copy pathcodegen.ts
File metadata and controls
28 lines (25 loc) · 1020 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
import { CodegenConfig } from '@graphql-codegen/cli'
export const URL_SCHEMA = 'https://inctagram.work/api/v1/graphql'
const config: CodegenConfig = {
documents: ['src/**/*.graphql'],
generates: {
'src/': {
config: {
withHooks: true,
},
plugins: ['typescript-operations', 'typescript-react-apollo'],
preset: 'near-operation-file',
presetConfig: {
baseTypesPath: '../src/shared/api/generated/types.generated.ts',
extension: '.generated.tsx',
},
},
'src/shared/api/generated/types.generated.ts': { plugins: ['typescript'] },
},
hooks: {
afterAllFileWrite: `node -p "const { execSync } = require('child_process'); const generatedFilePaths = process.argv.slice(1).map((generatedFilePath) => generatedFilePath.replaceAll(String.fromCharCode(92), '')); execSync('pnpm eslint --fix ' + generatedFilePaths.join(' '));"`,
},
ignoreNoDocuments: true, // for better experience with the watcher
schema: URL_SCHEMA,
}
export default config