File tree Expand file tree Collapse file tree 5 files changed +208
-210
lines changed Expand file tree Collapse file tree 5 files changed +208
-210
lines changed Original file line number Diff line number Diff line change 1+ API_DOMAIN = https://graphqlzero.almansi.me/api
2+ API_GENCOMMENT = /** @generated THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */
3+ # Если нужно больше информации при кодогенерации
4+ # DEBUG=1
5+ # VERBOSE=1
Original file line number Diff line number Diff line change 1- # FIXME: don't work globlally
2- overwrite : true
3- schema : https://graphqlzero.almansi.me/api
1+ # Конфигурация для кодогенерации схемы и запросов GraphQL для TypeScript
2+ # @remark Конфигурацию объявляем глобально, т.к. плагины должны использоваться одинаково для нескольких файлов
3+ schema : ${API_DOMAIN}
44documents : src/**/*.gql
5+ config :
6+ # Сгенерированные файлы напрямую менять нельзя (!), только через обертки / доп. файлы
7+ content : ${API_GENCOMMENT}
8+ # Работа с запросами ведется через react-hooks
9+ withHooks : true
10+ # Из типов для схемы исключается служебное поле __typename
11+ skipTypename : true
12+ # Все типы из схемы и запросов - иммутабельны
13+ immutableTypes : true
14+ # @experimental Опциональность полей - пока что отключена
15+ avoidOptionals : true
16+ # Типы генерируются на лету, без Pick - для чистоты информации по типу
17+ preResolveTypes : true
518generates :
619 src/types.ts :
7- - typescript
20+ plugins :
21+ - add
22+ - typescript
823 src/ :
924 preset : near-operation-file
25+ # Типы схемы и запросы - разделены
1026 presetConfig :
1127 extension : .gen.ts
1228 baseTypesPath : types.ts
13- config :
14- skipTypename : true
15- withHooks : true
16- immutableTypes : true
17- avoidOptionals : true
18- # Чтобы работал intelissense
19- preResolveTypes : true
20- # onlyOperationTypes: true
2129 plugins :
30+ - add
2231 - typescript-operations
23- - typescript-react-apollo
32+ - typescript-react-apollo
Original file line number Diff line number Diff line change 3131 "build" : " react-scripts build" ,
3232 "test" : " react-scripts test" ,
3333 "eject" : " react-scripts eject" ,
34- "api:gen" : " graphql-codegen"
34+ "api:gen" : " graphql-codegen -r dotenv/config" ,
35+ "api:gen--watch" : " graphql-codegen -r dotenv/config -w"
3536 },
3637 "eslintConfig" : {
3738 "extends" : " react-app"
4950 ]
5051 },
5152 "devDependencies" : {
53+ "@graphql-codegen/add" : " ^2.0.1" ,
5254 "@graphql-codegen/cli" : " ^1.17.10" ,
5355 "@graphql-codegen/near-operation-file-preset" : " ^1.17.11" ,
5456 "@graphql-codegen/typescript" : " ^1.17.10" ,
Original file line number Diff line number Diff line change 1+ /** @generated THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */
12import * as Types from '../../types' ;
23
34import { gql } from '@apollo/client' ;
You can’t perform that action at this time.
0 commit comments