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

refactor: Untrack generated files #335

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ethicnology
Copy link

This pull request remove all freezed.dart and g.dart files from version control.
These files are unnecessary tracked, they can be regenerated by the following commands:

  • flutter pub run build_runner build --delete-conflicting-outputs (deprecated)
  • dart run build_runner build --delete-conflicting-outputs (preferred)

This changes may break the current continuous integrations. I can't see/trigger the actions in this repo but we will probably need to update them with an extra step:
run: dart run build_runner build --delete-conflicting-outputs

@ethicnology ethicnology requested a review from i5hi November 28, 2024 14:13
@i5hi i5hi requested a review from mocodesmo December 13, 2024 09:25
@mocodesmo
Copy link
Collaborator

@ethicnology what are the benefits of doing this ? is a quality of life improvement ?

personally i prefer the generated files commit being in git because i don't need to keep the build_runner on while pulling.
this forces developers to keep build_runner on while using git

but i'm open to it if there is good reasoning

@mocodesmo
Copy link
Collaborator

Also every commit will always have compiler errors

Is it given in the freezed docs or flutter docs that generated files shouldn't be commited ?

@ethicnology
Copy link
Author

@mocodesmo

what are the benefits of doing this ? is a quality of life improvement ?

Generally, you should gitignore all files that can be generated in a deterministic way. Generated files can bloat the repository size over time, especially for projects with frequent updates to these files. In this case, we have 20k unnecessary lines tracked.

On my personal experience, I find it really annoying when it comes to commit to have unnecessary files appearing in my changes while I want to focus on the files that really matters.

personally i prefer the generated files commit being in git because i don't need to keep the build_runner on while pulling. this forces developers to keep build_runner on while using git

I get it, but if the developer has to create/modify a freezed class, he will have to execute the command anyway

Also every commit will always have compiler errors

Until you execute the command, it's a like a getting the dependencies, when you clone a flutter repository you have compilator errors until you execute flutter pub get. Same if you checkout/pull a branch with a dependencies changes.

Is it given in the freezed docs or flutter docs that generated files shouldn't be commited ?

Maintainer: "That's up to you. There's no official answer"

But, the example repository showcased excludes generated files from in the .gitignore

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