Open dan-cooke opened 3 years ago
Hi! So, you don't have *.graphqls
in your source code, but you launch a GraphQL server locally when you develop your project.
My recommendation is to commit schema.graphqls
or schema.json
in the case, so you can run a codegen command with different .graphql-let.yml
. Yes, pushing .d.ts
files will also solve the problem, but it'll be tricky since some of .d.ts
will be in node_modules
.
@piglovesyou thanks for the swift reply!
So I do have .graphql
files in my frontend - but they are just for queries and mutations. Not schema definition.
My schema
property in graphql-let.yml
is pointing to http://localhost:5000
- so everytime I run a build via webpack, the library will ping this endpoint for introspection.
my recommendation is to commit schema.graphqls or schema.json in the case, so you can run a codegen command with different .graphql-let.yml
This was going to be my workaround if we could not come up with a solution in graphql-let
. I was trying to avoid this approach however as my backend does not use .graphql
files either (uses graphql-compose
to generate the schema at runtime)
So here are my options at the minute:
Modify graphql-let
so that all it needs to run, is the index.d.ts files, this may involve moving all the index.d.ts files out of node_modules and into a directory which can be checked in - I see a similar issue raised here https://github.com/piglovesyou/graphql-let/issues/487
Spin up my backend server on my CI in order to build my frontend
Generate a schema.json
file in my frontend during development and use this for graphql-let
when running in CI.
I'm leaning towards option 1 personally, as it ensures a central source of truth for graphql-let
. The other 2 introduce possible inconsitencies.
Do you think it would be easy to implement the suggested change? I would be willing to give it a go
@dan-cooke You can fairly easily generate a schema.graphqls from your endpoint https://www.graphql-code-generator.com/docs/plugins/schema-ast
Hi, Is there a way to not run the codegen?
My use case is as follows:
schema
is pointing to a localhost graphql server in development.d.ts
files.If I check in the
.d.ts
files. - is this not enough forgraphql-let
to work?