-
Notifications
You must be signed in to change notification settings - Fork 1
/
codegen.ts
32 lines (30 loc) · 1.05 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
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
overwrite: true,
schema: 'http://localhost:6900/graphql',
// `src/gql/*` for useQuery/useMutation to return typed object
generates: {
// used by codegen to add proper typescript typing to results from a gql query/mutation
'frontend/src/gql/': {
preset: 'client',
documents: ['./frontend/src/**/*.tsx', './frontend/src/**/*.ts'],
presetConfig: { fragmentMasking: false },
plugins: [],
},
//graphql.schema.json used by URQL for caching
'frontend/public/graphql.schema.json': {
plugins: ['introspection'],
},
// `schema.graphql` for phpStorm GQL plugin to auto complete queries, consider moving to top (server) folder
'./schema.graphql': {
schema: 'http://localhost:6900/graphql',
plugins: ['schema-ast'],
},
// for importing types into server TS files
'./graphql-types.ts': {
plugins: ['typescript', 'typescript-operations'],
config: {},
},
},
};
export default config;