graphql-let icon indicating copy to clipboard operation
graphql-let copied to clipboard

allow passing schema plugins

Open villesau opened this issue 2 years ago • 6 comments

Enables passing plugins that work in similar manner to typescript and need to be generated in a single file.

Fixes: https://github.com/piglovesyou/graphql-let/issues/617

Let me know if this is something you'd consider merging and I can work on tests etc. I'm not sure if schemaPlugin is a correct term in this case, but that seemed to be already used in the codebase.

villesau avatar Feb 13 '22 23:02 villesau

Great. Could you make the build pass? My quick search finds this - Error: Unable to find template plugin matching typescript-urql-graphcache

piglovesyou avatar Feb 15 '22 13:02 piglovesyou

Sure, I'll fix the remaining tests :+1:

villesau avatar Feb 15 '22 16:02 villesau

@piglovesyou I've now updated the snapshots. is there something needed besides updated snapshots?

I added a mention about the schemaPlugins to the readme. It's a bit funny example since it has both urql and apollo, but I think the idea is the most important idea there.

villesau avatar Feb 15 '22 21:02 villesau

I would also consider getting rid of this since schemaPlugins allows controlling optional plugins from the outside:

https://github.com/piglovesyou/graphql-let/blob/88e9c52b1a0a8cd828fd3e4f5d7edd09e80a4b1c/src/lib/codegen.ts#L16-L27

and possibly the default typescript plugin since there's a risk for misconfiguration and having the typescript plugin twice. But those are breaking changes so it does not probably make sense to do such changes in this PR.

villesau avatar Feb 15 '22 22:02 villesau

Sounds so makes sense. Let's remove OPTIONAL_SCHEMA_PLUGINS (finally!) and ask users to specify typescript-resolvers explicitly. I don't take much time on this project lately, to be honest, so this would be the chance. Or you can leave it if you prefer, it's up to you. In both cases, I'll bump the minor version.

piglovesyou avatar Feb 16 '22 07:02 piglovesyou

Got rid of OPTIONAL_SCHEMA_PLUGINS and the related logic in the last commit.

villesau avatar Feb 16 '22 09:02 villesau