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: use OpenAPI file path for generator instead of stdin & modernize generator-cli #3214

Merged
merged 24 commits into from
Feb 28, 2025

Conversation

Lodin
Copy link
Contributor

@Lodin Lodin commented Feb 7, 2025

This pull request includes significant updates to both the Java and TypeScript codebases, focusing on improving the GeneratorProcessor and GeneratorIO functionalities. The most important changes include the use of direct read of an OpenAPI file instead of copying it to stdin, refactoring the TypeScript generator CLI to use URLs, and updating the test suite to reflect these changes.

Java Changes:

  • GeneratorProcessor Enhancements:
    • Used a OpenAPI file name path as an CLI argument instead of copying it to stdin. (packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java)

TypeScript Changes:

  • GeneratorIO Refactoring:

    • Updated GeneratorIO to use URL instead of string paths for file operations. (packages/ts/generator-cli/src/GeneratorIO.ts) [1] [2]
  • CLI Improvements:

    • Refactored the CLI to use parseArgs for argument parsing and removed meow. (packages/ts/generator-cli/src/index.ts)
    • Removed the processInput utility function and updated the CLI to accept the input file path to read it directly. (packages/ts/generator-cli/src/index.ts)
  • Testing Enhancements:

    • Updated tests to reflect changes in GeneratorIO and added new tests for the CLI. (packages/ts/generator-cli/test/GeneratorIO.spec.ts, packages/ts/generator-cli/test/cli.spec.ts) [1] [2]
    • Added a new test plugin for better test coverage. (packages/ts/generator-cli/test/TestPlugin.ts)

@Lodin Lodin added the hilla Issues related to Hilla label Feb 7, 2025
@Lodin Lodin requested review from platosha, cromoteca and taefi February 7, 2025 10:00
Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 91.66667% with 4 lines in your changes missing coverage. Please review.

Project coverage is 86.89%. Comparing base (1795b9d) to head (a8a29fa).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/ts/generator-cli/src/GeneratorIO.ts 91.66% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3214   +/-   ##
=======================================
  Coverage   86.89%   86.89%           
=======================================
  Files         115      115           
  Lines        8300     8287   -13     
  Branches     1269     1269           
=======================================
- Hits         7212     7201   -11     
+ Misses       1074     1072    -2     
  Partials       14       14           
Flag Coverage Δ
unittests 86.89% <91.66%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Contributor

@cromoteca cromoteca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a little doubt about packages/ts/generator-cli/test/fixtures/version.snap

@Lodin Lodin requested a review from cromoteca February 25, 2025 10:58
# Conflicts:
#	package-lock.json
#	packages/ts/generator-cli/package.json
@Lodin Lodin requested a review from platosha February 28, 2025 14:30
@platosha platosha enabled auto-merge (squash) February 28, 2025 16:01
@platosha platosha merged commit d87eb73 into main Feb 28, 2025
16 checks passed
@platosha platosha deleted the refactor/generator-cli/file-read branch February 28, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hilla Issues related to Hilla
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants