cometkim / gatsby-plugin-typegen

Let's give developers using GatsbyJS better DX with extreme type-safety
https://www.gatsbyjs.org/packages/gatsby-plugin-typegen/
MIT License
204 stars 23 forks source link

v3 #138

Closed cometkim closed 2 years ago

cometkim commented 3 years ago

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

Todos

Issues

lgtm-com[bot] commented 3 years ago

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

new alerts:

lgtm-com[bot] commented 3 years ago

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

new alerts:

lgtm-com[bot] commented 3 years ago

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

new alerts:

lgtm-com[bot] commented 3 years ago

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

new alerts:

cometkim commented 3 years ago

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.

lgtm-com[bot] commented 2 years ago

This pull request introduces 2 alerts and fixes 26 when merging 54245b02c941b77ef5a1054ff84b340eaa43249a into 223d73b974262ed38176bf1caf4b2e6328228cf6 - view on LGTM.com

new alerts:

fixed alerts:

cometkim commented 2 years ago

This has been a burden on my mind for a long time. Now I think most of the work is done and I've fixed almost all the issues.

The v3 changes are mostly minor changes to make internal behavior stable.

There are several deprecated options, but with a simple name change, the operation is maintained up to v4, so you can update the version without worrying about the site being broken.

Here is some highlight.

I really appreciate Easy Agile team for continuing to fund the project while it was being silent. Your funds will be used for future contributions and maintenance.

cometkim commented 2 years ago

gatsby-plugin-typegen@v3.0.0-rc.0 is availiable

cometkim commented 2 years ago

I will fix the CI and some documentation before release.

In the meantime, try it on your project and send me feedback

LekoArts commented 2 years ago

I'd assume you could move the yarn changes to another PR or already apply the yarn/.gitignore changes to the main branch? Then this PR will have way less changed files and the changes made are clearer :)

lgtm-com[bot] commented 2 years ago

This pull request introduces 2 alerts when merging f1e5f1a17b9351097c77f3ede1b330b7825c1955 into 5f78b2a8560e4f45f8b79587ba2ef0bf08f22bab - view on LGTM.com

new alerts:

cometkim commented 2 years ago

I found a bug in the Flow codegen, but fortunately I don't think it's fatal, as Flow doesn't break the full type checking and still maintains high type coverage via powerful inference.

The issue can be fixed upstream eventually.

LekoArts commented 2 years ago

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 😆

LekoArts commented 2 years ago

Notes from trying out the RC (I'll add more as I try it out):

cometkim commented 2 years ago

There hasn't been an update since I've been busy with business lately, but it would be all checked and released this week or early next week.

I will test the compatibility of the new version of Gatsby with Gatsby Cloud in my public production.

cometkim commented 2 years ago

@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 commented 2 years ago

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 commented 2 years ago

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 :sweat_smile:

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 commented 2 years ago

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 commented 2 years ago

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[bot] commented 2 years ago

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

new alerts:

cometkim commented 2 years ago

Merged to main