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

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

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

sonarqubecloud bot commented Feb 7, 2025

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.91%. Comparing base (881f960) to head (10c1100).

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.91%   86.91%           
=======================================
  Files         118      118           
  Lines        8191     8178   -13     
  Branches     1256     1256           
=======================================
- Hits         7119     7108   -11     
+ Misses       1058     1056    -2     
  Partials       14       14           
Flag Coverage Δ
unittests 86.91% <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.

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.

1 participant