Skip to content
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

Add user configurability for file extensions and watched file path #5

Merged
merged 4 commits into from
Sep 3, 2021

Conversation

claycoleman
Copy link
Contributor

@claycoleman claycoleman commented Sep 3, 2021

Hi @capaj, this extension rocks – really interested in using it for my project, but our team declares our graphql directly inside of our ts or tsx files. so i'd like to add a couple settings to allow this:

  • "graphql-codegen.fileExtensionsDeclaringGraphQLDocuments": change which file extensions are watched for saves. currently this is hardcoded to graphql and gql.
  • "graphql-codegen.filePathToWatch": allow users to specify a file path that files should match before running codegen. this is important as users could specify a more broad file (eg ts) that could exist in both paths relevant to graphql generation and paths that are not.

I'd like to use this extension for my project, but our team declares our graphql directly inside of our `ts` or `tsx` files. so i'd like to add a couple settings to allow this:
- `"graphql-codegen.fileExtensionsDeclaringGraphQLDocuments"`: change which file extensions are watched for saves. currently this is hardcoded to `graphql` and `gql`.
- `"graphql-codegen.filePathToListen"`: allow users to specify a file path that files should match before running codegen. this is important as users could specify a more broad file (eg `ts`) that could exist in both paths relevant to graphql generation and paths that are not.
- read from the workspace config
- find some extension match
- match the pattern using `multimatch`
- change key name to something better
- add markdown description
Copy link
Owner

@capaj capaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! will release shortly

@capaj capaj merged commit f5a1fa7 into capaj:master Sep 3, 2021
@capaj
Copy link
Owner

capaj commented Sep 3, 2021

for TS files there would be a better solution though. We can check whether the file has a gql template literal or not and only run codegen when we find it. I'll add this as a config in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants