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

chore: simplify generator #299

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

chore: simplify generator #299

wants to merge 5 commits into from

Conversation

Lodin
Copy link
Contributor

@Lodin Lodin commented Feb 16, 2025

This PR significantly simplifies React wrapper generation; instead of TypeScript AST, it uses plain strings which improves the readability of the code. The code has been reduced by more than half as well. TypeScript is still used for catching syntax errors and apply common style in generated files; though, we can remove this step if needed.

Also, the generator script drops the custom fswalk and fromAsync functions in favor of the native glob (it is experimental but since it is our internal script I consider it ok). However, this change requires Node v22 LTS.

Since there are two packages managed by a root tsconfig, and glob needs newer TS libs, I had to switch the root to esnext. To keep packages on es2021, I created separate tsconfig.json files for each package. So, now, we can use es2021 for packages and use any modern stuff in our scripts.

EDIT:
Since I faced an issue in vaadin/hilla repo (we use Node v20 instead of Node v22 for building Vaadin 24.x, and going to move to Node v22 only in Vaadin 25), I decided to replace the native glob with the similar implementation from the node-glob package. I have also replaced all the obsolete utils (fswalk and fromAsync) with the glob, which revealed a minor error in the package.json update (deeply nested CSS folders were not visited and put into the package.json).

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.

1 participant