@@ -21,13 +21,15 @@ yarn add graphql-scalars
2121
2222### Setup
2323
24+ #### Files
25+
2426``` graphql
25- # src/graphql/modules/ base/schema.graphqls
27+ # src/schema/ base/schema.graphql
2628type Query
2729```
2830
2931```graphql
30- # src/graphql/modules/ user/schema.graphqls
32+ # src/schema/ user/schema.graphql
3133extend type Query {
3234 user (id : ID ! ): User
3335}
@@ -44,7 +46,7 @@ type Address {
4446```
4547
4648````ts
47- // src /graphql / modules / user /schema .mappers.graphqls
49+ // src /schema / user/schema.mappers.graphql
4850
4951// Exporting the following Mapper interfaces and types is the equivalent of this codegen config:
5052// ```yml
@@ -62,24 +64,41 @@ export interface UserMapper {
6264}
6365````
6466
67+ #### Codegen Config
68+
69+ ```ts
70+ // codegen .ts
71+ import { defineConfig } from '@eddeee888 /gcg -typescript -resolver -files ';
72+ const config : CodegenConfig = {
73+ schema : '**/schema .graphql ',
74+ generates : {
75+ 'src /schema ': defineConfig (),
76+ },
77+ };
78+ export default config ;
79+ ```
80+
81+ OR
82+
6583``` yml
6684# codegen.yml
67- schema : '**/*.graphqls '
85+ schema : ' **/*.graphql '
6886generates :
69- src/graphql/modules :
87+ src/schema :
7088 preset : ' @eddeee888/gcg-typescript-resolver-files'
89+ watchPattern : ' **/*.mappers.ts'
7190` ` `
7291
7392### Result
7493
7594Running codegen will generate the following files:
7695
77- - `src/graphql/modules /user/resolvers/Query/user.ts`
78- - `src/graphql/modules /user/resolvers/User.ts`
79- - `src/graphql/modules /user/resolvers/Address.ts`
80- - `src/graphql/modules /resolvers.generated.ts`
81- - `src/graphql/modules /typeDefs.generated.ts`
82- - `src/graphql/modules /types.generated.ts`
96+ - ` src/schema /user/resolvers/Query/user.ts`
97+ - ` src/schema /user/resolvers/User.ts`
98+ - ` src/schema /user/resolvers/Address.ts`
99+ - ` src/schema /resolvers.generated.ts`
100+ - ` src/schema /typeDefs.generated.ts`
101+ - ` src/schema /types.generated.ts`
83102
84103# # Config Options
85104
@@ -200,9 +219,9 @@ Custom preset config can be set using the `presetConfig` option:
200219
201220` ` ` yml
202221# codegen.yml
203- schema: '**/*.graphqls '
222+ schema: '**/*.graphql '
204223generates:
205- src/graphql/modules :
224+ src/schema :
206225 preset: '@eddeee888/gcg-typescript-resolver-files'
207226 presetConfig:
208227 mode: 'modules'
0 commit comments