-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extensions config file search logic is not compatible with graphql-code-generator config search #21
Comments
oh yeah I will import the function from graphql-codegen as my PR was merged: |
@neongreen this is interesting. I will put guard in place for this type error to never happen, but it's weird, because according to graphql-codegen/cli a config object should be always returned |
@neongreen in 1.1.0 it won't find find your config anyway, but at least the type error should be fixed. |
In 1.1.0 it should tell you that config was not found, when you explicitly run the command. |
@capaj here's my config: // codegen.ts
import type { CodegenConfig } from '@graphql-codegen/cli'
import { printSchema } from 'graphql'
import { schema } from '@lib/graphql/schema'
const config: CodegenConfig = {
schema: printSchema(schema),
documents: ['{components,lib,pages}/**/!(*.graphql).{ts,tsx}'],
generates: {
'./generated/graphql/': {
preset: 'client',
plugins: [],
},
},
}
export default config I also have a |
Update: after upgrading to 1.1.0 I'm getting a different error, see #29. |
I haven't tested with a ts file as config. I always use yaml or json. Will try next weekend. |
@capaj wondered if you managed to look into this? As far as I can tell it's just ignoring my codegen.ts file. |
I've struggled when trying to use single graphql config file for all vscode extensions (graphql releated):
graphql.vscode-graphql and @graphql-codegen/cli both searching configs by graphql-config rules
So for example if you have
graphql.config.js
file for config.npm exec -- graphql-codegen
)but
graphql-codegen-vscode
won't, because it doesnt relay on @graphql-codegen/cli config search, it has it's own generateSearchPlaces.tsSo to setup "single" config i dive into graphql-codegen-vscode and found out that it has over config search logic. According to it i created
codegen.js
with content:Not very clean...
Also until i created that file graphql-codegen-vscode didn't even alert that it can't find config. It just didn't run silently.
From my perspective as a creators of a 3rd party libraries/extensions based on a some original lib we should not override native/original logic. Because if we do - user of our lib must know docs of original lib and also our docs (if it exists). And our library inevitably will go out of date or you will need keep an eye on each release and sync your code with original.
So
graphql-codegen-vscode
should not override native behavior of @graphql-codegen/cli tooling. In that particular case - should not have alternative config search.The text was updated successfully, but these errors were encountered: