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

v3 #138

Closed
wants to merge 47 commits into from
Closed

v3 #138

wants to merge 47 commits into from

Conversation

cometkim
Copy link
Owner

@cometkim cometkim commented Jan 3, 2021

https://github.com/cometkim/gatsby-plugin-typegen/milestone/3

Todos

  • Predictable & Debuggable scheduler (Thanks to XState)
  • Remove graphql-tools dependency and integrate more inside Gatsby
  • Integration with stable lifecycle API (SET_SCHEMA and SET_GRAPHQL_DEFINITIONS)
  • Clean implementation & Tests
    • codegen
    • emitSchema
    • emitPluginDocument
    • autofix
  • E2E Test on example project
    • Add TypeScript example
    • Add Flow example

Issues

@cometkim cometkim self-assigned this Jan 3, 2021
@cometkim cometkim changed the title v3 WIP: v3 Jan 3, 2021
@lgtm-com
Copy link

lgtm-com bot commented Jan 13, 2021

This pull request introduces 1 alert when merging e8c0f4f into 2bcbfc7 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented May 10, 2021

This pull request introduces 3 alerts when merging c8aad18 into 7ee59cd - view on LGTM.com

new alerts:

  • 3 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented May 11, 2021

This pull request introduces 3 alerts when merging bbde5d7 into 223d73b - view on LGTM.com

new alerts:

  • 3 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented May 11, 2021

This pull request introduces 3 alerts when merging 3e08ca9 into 223d73b - view on LGTM.com

new alerts:

  • 3 for Unused variable, import, function or class

@cometkim
Copy link
Owner Author

I took a long break from working on this project.

I still have a lot of ideas and things to improve, but I'm losing focus. (even though I'm still actively using this plugin for my gatsby projects)

Maybe we need to get another maintainer after this work. please contact me if anyone has an interest.

@cometkim
Copy link
Owner Author

cometkim commented Mar 30, 2022

@LekoArts VSCode extension's feature should work with valid graphql-config, or if invalid, it must be reported by it.

The emitPluginDocument option exists to extract the pre-defined fragments by the plugin or gatsby core and should not have any effect on the project if not used.

It would be a good idea to keep valid settings together in examples.

@cometkim
Copy link
Owner Author

The plugin intentionally creates types only for named queries.

It requires using a globally unique query name for maintaining the correct colocation pattern and is also a limitation of both Gatsby and GraphQL Codegen.

When it is not given, Gatsby uses the pathname to make it internally, but this is inappropriate as a type name and can be easily broken by moving files.

@cometkim
Copy link
Owner Author

This PR seems to remove a lot of files in plugin/.yarn/cache, can you also do this in master and rebase then? The GitHub UI is really laggy with this amount of files laughing

@LekoArts I've tried it, but it seems that GitHub has already given up tracking changes here 😅

The code has been rewritten almost from scratch, so it will be better to walk around the code directly in the branch than to read the changes.

@cometkim
Copy link
Owner Author

I've checked that this works well in production and doesn't cause any issues on Gatsby Cloud (Fixes #109)

However, it seems that some documents included within the theme are not generated properly.

And flattenGeneratedTypes option makes generated types a bit bloated

@kvchen
Copy link

kvchen commented May 14, 2022

Is it possible to add the flattenGeneratedTypesIncludeFragments: true option in addition to flattenGeneratedTypes? In v2, the exported types included named fragments - that seems to have gone away in v3. This makes it difficult to use typed GraphQL fragments in subcomponents.

I'd file a new pull request, but the change is so small that it might be easier to just add it to this pull request.

@lgtm-com
Copy link

lgtm-com bot commented May 16, 2022

This pull request introduces 2 alerts when merging 42650bd into 5f78b2a - view on LGTM.com

new alerts:

  • 2 for Variable not declared before use

@cometkim
Copy link
Owner Author

Merged to main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment