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

Flutter freezed v4.0.0 #47

Merged
merged 18 commits into from
Jan 20, 2023
Merged

Flutter freezed v4.0.0 #47

merged 18 commits into from
Jan 20, 2023

Conversation

Parables
Copy link
Contributor

Description

The motivation for this version started when @endigo identified some bugs with the plugin.

As a quick resolution, I suggested this solution .

Then it hit me... I took a look at the schema @endigo mentioned and realized how big it was, I tried implementing my initial suggestion on that schema and ended up with a bloated config file spanning close to 500 lines just for some minor configurations.

I was working on a project at that time and was writing pure CSS. It was then that I began to wonder how certain CSS properties have multiple syntaxes. Taking inspiration from the flexibility CSS offers, I began experimenting with RegExp to be used for configuring the plugin.

Initially, I thought I was going too far with this but I stubbornly persisted... +3 months of sleepless nights debugging and tons of refactoring later, comes this PR which hopefully might inspire other plugins too.

Documentation is still in progress and video tutorials will soon follow once this PR gets merged.

Looking forward to your usual collaboration @charlypoly, @Urigo and all the team at the Guild

Related # (issue)
Replaces #8350 and #14

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

All modules have a corresponding test file that verifies the generated output.

  1. Install the dependencies with yarrn
  2. run yarn test

Test Environment:

  • OS: Garuda Linux
  • @graphql-codegen/...: latest
  • NodeJS: latest

Checklist:

  • I have followed the CONTRIBUTING doc and the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

TypeNamePattern are used to configure the class and its factories whiles the FieldNamePattern is used to configure the parameters.

New plugin-config interface
Using tuples instead of Records, we sacrifice IDE auto-complete and bloated config for positional(poor IDE support) but compact config

New interface
config-value provides some methods that parses the config and returns ready-to-consume values in the various blocks
…e domains

applying DDD concepts: moved every function into its appropirate domain

dropped support for customDecorators, FreezedFactoryBlockRepository class renamed to NodeRepository class, FreezedConfigValue class  renamed to Config classs
The previous version mutated properties of the class to generated the output. This made it very difficult to write tests without running the whole plugin and good luck tracking bugs and wrong generated output. This rewrite used functions everywhere for everything. Being static methods, you can test each independently without having to create a full instance of the class. Using value objects eliminates the use of primitive values plus ensures that we have a valid value everytime.
@changeset-bot
Copy link

changeset-bot bot commented Jan 16, 2023

🦋 Changeset detected

Latest commit: b6c4b01

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-codegen/flutter-freezed Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Parables
Copy link
Contributor Author

Sincere gratitude to @auaicn and @endigo and everyone who has helped along the way 🥂

@Parables
Copy link
Contributor Author

@charlypoly @Urigo we have a green flag ... over to you

@saihaj
Copy link
Collaborator

saihaj commented Jan 17, 2023

hey @Parables can you create a changeset #47 (comment)

@Parables
Copy link
Contributor Author

Sure, I will that around 10pm GMT

@Parables
Copy link
Contributor Author

@saihaj done as requested

@Parables
Copy link
Contributor Author

@saihaj I have to correct some typos and grammatical errors in the guide but I have to do that at school as I am already running late. Give me about 1 hour 30 mins to get to school so that we can continue

@Parables
Copy link
Contributor Author

And please how do I fix the prettier error?

@Parables
Copy link
Contributor Author

@saihaj I am back, what else do you need me to do?

@saihaj
Copy link
Collaborator

saihaj commented Jan 18, 2023

@saihaj I am back, what else do you need me to do?

@Parables can you run yarn prettier so CI is happy then I can merge and release this.

@Parables
Copy link
Contributor Author

Parables commented Jan 19, 2023

@Parables can you run yarn prettier so CI is happy then I can merge and release this.

Done that but there are no changes to be committed here on my local branch.

However, when I run yarn to install the dependencies, other packages were modified.

I didn't commit them because it was not my intention to modify them.

Any other solution?

@saihaj
Copy link
Collaborator

saihaj commented Jan 19, 2023

@Parables can you run yarn prettier so CI is happy then I can merge and release this.

Done that but there are no changes to be committed here on my local branch.

However, when I run yarn to install the dependencies, other packages were modified.

I didn't commit them because it was not my intention to modify them.

Any other solution?

weird I pulled this branch and ran prettier and it was just this plugin b6c4b01

@Parables
Copy link
Contributor Author

Thanks very much @saihaj. I couldn't have figured out this issue on my own.

The guide for this plugin on the website to has been updated.

Everything is ready now for release.

@saihaj saihaj merged commit f562006 into dotansimha:main Jan 20, 2023
@saihaj
Copy link
Collaborator

saihaj commented Jan 20, 2023

hmm so something went wrong with CI publish flow. So will investigate it @Parables

@Parables
Copy link
Contributor Author

Thanks very much for your dedication @saihaj

@saihaj
Copy link
Collaborator

saihaj commented Jan 21, 2023

/theguild newsletter

@github-actions github-actions bot mentioned this pull request Jan 22, 2023
@saihaj
Copy link
Collaborator

saihaj commented Jan 22, 2023

released @Parables https://github.com/dotansimha/graphql-code-generator-community/releases/tag/release-1674417409150

@Parables
Copy link
Contributor Author

Parables commented Jan 23, 2023

Thank you all so much for the support.

This release wouldn't be possible without you:

@saihaj
@charlypoly
@Urigo
@endigo
@n1ru4l
@auaicn
@gabsn
@Ayiks
@everyone

Cheers 🥂

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