I'm using the @graphql-codegen/cli where my confirguration is set to output to a graphql and graphql-sdk file:
'http://localhost:8080/v1/graphql':
headers:
secret: "devsecret"
'http://localhost:3000/api/auth':
headers:
secret: "devsecret"
documents: './**/*.graphql'
overwrite: true
generates:
generated/graphql-sdk.ts:
config:
rawRequest: true
plugins:
- 'typescript'
- typescript-graphql-request
- 'typescript-operations'
- fragment-matcher:
apolloClientVersion: 3
module: es2015
useExplicitTyping: false
generated/graphql.ts:
config:
reactApolloVersion: 3
withHooks: true
withComponent: false
withHOC: false
skipTypename: true
plugins:
- 'typescript'
- 'typescript-operations'
- 'typescript-react-apollo'
- fragment-matcher:
apolloClientVersion: 3
module: es2015
useExplicitTyping: false
Is it possible to merge both codegen'd configs into the same .ts file.
In addition the above both require the mutations and queries to be in *.graphql file, is there a way to make the codegen scrape .ts/.tsx files for queries (with the gql tag - like gql(...some query...)
?).
I tried putting the 'documents' in an array like:
documents: ['./**/*.graphql', './**/.ts', './**/.tsx']
But it was being ignored.