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

[NOREF] Use new graphql-codegen tool #655

Merged
merged 5 commits into from
Jul 31, 2023
Merged

Conversation

ClayBenson94
Copy link
Collaborator

EASI-000

Changes and Description

  • Introduce new queriesCodegen folder, where all queries will reside for the new codegen tool

The high level approach used here is to introduce graphql-codegen, which is more supported than the apollo codegen tool we're using (see this issue). The goal is to introduce a way to slowly cut over queries to this new codegen tool without having to completely and immediately deprecate apollo codegen.

Looking for feedback on the following:

  • Organization of files (one file per query? Multiple? Both are supported!)
  • Naming (Not sure if LOVE queriesCodegen - could be convinced to name this something else
  • Any additional configs/settings that the new codegen tool might provide that we should enable here!

How to test this change

  • Run scripts/dev gql to ensure no files change
  • Try adding a new query to src/queriesCodegen and using it within the app!

PR Author Review Checklist

  • Met the ticket's acceptance criteria, or will meet them in a subsequent PR.
  • Added or updated tests for backend resolvers or other functions as needed.
  • Added or updated client tests for new components, parent components, functions, or e2e tests as necessary.
  • Updated the Postman Collection if necessary.

PR Reviewer Guidelines

  • It's best to pull the branch locally and test it, rather than just looking at the code online!
  • Check that all code is adequately covered by tests - if it isn't feel free to suggest the addition of tests.
  • Always make comments, even if it's minor, or if you don't understand why something was done.

@ClayBenson94 ClayBenson94 requested review from a team as code owners July 28, 2023 14:48
@ClayBenson94 ClayBenson94 requested review from garyjzhao and patrickseguraoddball and removed request for a team July 28, 2023 14:48
Comment on lines +180 to +184
"comments": {
"on_resolutions": {
"graphql": "Having graphql fixed at 15.8.0 allows apollo codegen and graphql-codegen to work together. Once the former is deprecated, you can remove this",
"typed_document_node": "https://github.com/dotansimha/graphql-code-generator/issues/9293"
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Trying something here - I wanted to document a few things that I did in the package.json, but since it's just JSON, it doesn't support actual comments, and some places online recommended just throwing a custom object in there for stuff like this!

@patrickseguraoddball
Copy link
Contributor

patrickseguraoddball commented Jul 28, 2023

Thanks for this, can't wait to use it!

I like the idea of one file for all the generated types.

Also not sure if I also love the name queriesCodegen. I think queries isn't encapsulating (mutations, subscriptions). Maybe something like apolloGQL. Eventually we will deprecate gql-gen and naming it Codegen won't really matter. Idk just thoughts.

Are fragment-asking.ts generated or externally sourced code? If so can we get a comment here or in the code of the source?

This works great! Looking through the documentation further to see if there could be any other useful additional config

@ClayBenson94
Copy link
Collaborator Author

I'll go through these item by item!

Thanks for this, can't wait to use it!

Of course! 🙏

I like the idea of one file for all the generated types.

Same - I think it makes our file structure a bit cleaner, and navigating these auto-generated files is not usually of much importance

Also not sure if I also love the name queriesCodegen. I think queries isn't encapsulating (mutations, subscriptions). Maybe something like apolloGQL. Eventually we will deprecate gql-gen and naming it Codegen won't really matter. Idk just thoughts.

Same - I think I'll try committing a change to this in this spirit.

Are fragment-asking.ts generated or externally sourced code? If so can we get a comment here or in the code of the source?

Everything in src/gql/ is auto-generated, including this file! I can maybe add a quick update to the README or to this directory directly explaining this!

This works great! Looking through the documentation further to see if there could be any other useful additional config

👍 Appreciate it! Let me know if you identify anything 😄

Copy link
Contributor

@patrickseguraoddball patrickseguraoddball left a comment

Choose a reason for hiding this comment

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

Works great, and the structure makes sense

@ClayBenson94 ClayBenson94 merged commit 3cbe166 into main Jul 31, 2023
@ClayBenson94 ClayBenson94 deleted the NOREF/graphql_codegen branch July 31, 2023 18:08
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