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

Switch from apollo to graphql-codegen #1721

Closed
louischan-oursky opened this issue Jan 6, 2022 · 1 comment · Fixed by #2081
Closed

Switch from apollo to graphql-codegen #1721

louischan-oursky opened this issue Jan 6, 2022 · 1 comment · Fixed by #2081

Comments

@louischan-oursky
Copy link
Collaborator

louischan-oursky commented Jan 6, 2022

I spent some time on studying on how to migrate from apollo to graphql-codegen seamlessly. Unfortunately graphql-codegen does not provide no-brainer way to migrate. It is possible to mimic the behavior of generating multiple files next to the source file in __generated__/[OperationName].ts. However, The [OperationName_Type_fieldName] naming convention cannot be achieved. Therefore, migration requires us to adopt the convention of graphql-codegen, which requires significant code change on how our hand-written code interacts with the generated code.

@louischan-oursky
Copy link
Collaborator Author

louischan-oursky commented Jun 8, 2022

Goals

  • Use graphql-codegen to generate codes

Requirements

  • Place graphql queries and mutations in .graphql, as opposed to our current convention of gql call in .ts files
  • Each .graphql contains either ONE query or ONE mutation
  • The name of the query or mutation is in lowercase.
  • The name of the .graphql follows the query or the mutation it contains
  • Install necessary plugins so that the generated code exports the following
    • The gql call
    • The relevant types
    • The useXXX query hook or mutation hook

@andychow326 andychow326 linked a pull request Jun 10, 2022 that will close this issue
louischan-oursky added a commit that referenced this issue Jun 13, 2022
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 a pull request may close this issue.

1 participant