Replies: 1 comment 6 replies
-
Hi @Borvik, A simple setup relying on both codegen.ts (with last import { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: 'http://localhost:3000/graphql',
documents: 'path-to-client/**/*.tsx',
generates: {
'./src/types.ts': {
plugins: ['typescript', 'typescript-operations']
}
}
};
export default config; Does this would fit your use-case? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So... I've got a relatively unique scenario and I'm not sure if the code-generator supports it or if it does how it supports it.
Note... I'm open to changing how our process currently works if I can find a solution that will allow code-generator to work.
Also note... I know this isn't the most "react" way of doing things... but it works, and being a monolithic application it might take a while to implement and test any suggestions.
The Current Setup
We have a fairly large react application that uses SSR with loadable-components and react-apollo (unfortunately not up-to-date).
We have clients that like to request changes that are specific to them and no one else that sometime necessitates query and/or component structural changes - so we developed something of a "override" system.
Our main application is actually built as a library with a single entry point that starts the express server and renders the code.
Our client application
imports
the main application and just calls start. The main application provides hooks (not react hooks, more override points) to allow customizing the code.Basic example
main
Client
When finally run, this would run the graphql query:
And output:
The Question
With the setup now out of the way, the question is can graphql code-generator even handle a scenario like this - and if so, how would I restructure this to allow for the extensibility we need? I think I figured out the server side of this so, the client side is the last bit I need to investigate.
I'd like to get rid of those
any
types in both our main application and client applications without having to manually update the types all the time.Beta Was this translation helpful? Give feedback.
All reactions