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: Fix autogenerate TS types #2460

Closed
wants to merge 2 commits into from

Conversation

dplewis
Copy link
Member

@dplewis dplewis commented Feb 19, 2025

Pull Request

Issue

Currently developers would have to generate types themselves before committing. This could lead to types being missing in the future. I know there was talks for removing husky #2251 and there maybe a better way to do this. I'm open to discussion.

Approach

  • Improve type build speed by removing prettier and lint formatting
  • Regenerate all types
  • Generate types per commit.

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)

Copy link

parse-github-assistant bot commented Feb 19, 2025

Thanks for opening this pull request!

  • ❌ Please link an issue that describes the reason for this pull request, otherwise your pull request will be closed. Make sure to write it as Closes: #123 in the PR description, so I can recognize it.

Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (a929019) to head (7706a23).

Additional details and impacted files
@@            Coverage Diff            @@
##             alpha     #2460   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           64        64           
  Lines         6256      6256           
  Branches      1451      1476   +25     
=========================================
  Hits          6256      6256           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mtrezza
Copy link
Member

mtrezza commented Feb 19, 2025

Doesn't this cause quite a delay when building the types on every commit? I mean if a developer commits every few lines, that would trigger type rebuilding every time.

@dplewis
Copy link
Member Author

dplewis commented Feb 19, 2025

That is correct. It's about 3-5 seconds.

@mtrezza
Copy link
Member

mtrezza commented Feb 20, 2025

And that delay may depend on the machine one is working on and be even slower in some cases. Not a fan of pre-commit hooks for code generation or modification - for many reasons. I believe a failing CI test and a good description in the error message makes more sense. Let's take the Parse Server options definitions for example. Generating them automatically would be a bad idea, because if someone edits a generated file instead of the source file for definitions, that change is lost and may go unnoticed. Better just fail. As for reviewing; mostly just requires pointing to the failing CI job and the contributor should know themselves what to do - with a good error msg. We should really get rid of husky.

@dplewis dplewis changed the title refactor: Autogenerate TS types with husky refactor: Fix autogenerate TS types Feb 20, 2025
@dplewis
Copy link
Member Author

dplewis commented Feb 20, 2025

mostly just requires pointing to the failing CI job and the contributor should know themselves what to do - with a good error msg.

Let's do this. In this case removing build:types from the CI should let us know that a type is missing if the contributor writes a test case. We will have to ensure a test is written everytime a type has changed.

@dplewis dplewis mentioned this pull request Feb 20, 2025
2 tasks
@dplewis
Copy link
Member Author

dplewis commented Feb 20, 2025

Closing in favor of #2462

@dplewis dplewis closed this Feb 20, 2025
@dplewis dplewis deleted the auto-generate-types branch February 20, 2025 16:49
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