Skip to content

feat: add utility to auto-detect Hilla views usage - #18602

Merged
mshabarov merged 2 commits into
mainfrom
feat/18577-auto-detect-hilla
Feb 5, 2024
Merged

mshabarov merged 2 commits into
mainfrom
feat/18577-auto-detect-hilla

Conversation

@tltv

@tltv tltv commented Feb 2, 2024 •

Copy link
Copy Markdown
Contributor

Adds FrontendUtils.isHillaViewsUsed(File frontendDir) to check if Hilla views are used in routes.ts or routes.tsx file. This does the check based on these two files only and the routes array variable content without doing any validation.

Hilla views are in use in following cases based on the routes array:

  • If file does not contain ...serversideRoutes
  • If routes contains anything else in addition to ...serversideRoutes
  • If tsx has ...serversideRoutes in MainLayout's children array

Hilla views are not used in following case:

  • If ...serversideRoutes is the only item

Related-to: #18577

Adds `FrontendUtils.isHillaViewsUsed(File frontendDir)` to check if Hilla views are used in routes.ts or routes.tsx file. This does the check based on these two files only and the `routes` array variable content without doing any validation.

Hilla views are in use in following cases based on the `routes` array:
- If file does not contain `...serversideRoutes`
- If `routes` contains anything else in addition to `...serversideRoutes`
- If tsx has `...serversideRoutes` in MainLayout's `children` array
Hilla views are not used in following case:
- If `...serversideRoutes` is the only item
@github-actions

github-actions Bot commented Feb 2, 2024 •

Copy link
Copy Markdown
Contributor

Test Results

1 092 files  ± 0  1 092 suites  ±0   1h 21m 6s ⏱️ -36s
6 848 tests +12  6 802 ✅ +12  46 💤 ±0  0 ❌ ±0 
7 170 runs  + 1  7 112 ✅ + 1  58 💤 ±0  0 ❌ ±0 

Results for commit 5ba6989. ± Comparison against base commit 5c7ba9e.

♻️ This comment has been updated with latest results.

@vaadin-bot vaadin-bot added +1.0.0 and removed +0.0.1 labels Feb 2, 2024
@sonarqubecloud

sonarqubecloud Bot commented Feb 2, 2024

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@mshabarov mshabarov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested with the following configurations:

  • plain Flow app
  • hybrid Hilla + Flow + React app
  • Hilla + React app
  • hybrid Hilla + Flow + Lit

In all cases return expected resolution.

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 24.4.0.alpha3 and is also targeting the upcoming stable 24.4.0 version.

rodolforfq pushed a commit that referenced this pull request Feb 8, 2024
* feat: add utility to auto-detect Hilla views usage

Adds `FrontendUtils.isHillaViewsUsed(File frontendDir)` to check if Hilla views are used in routes.ts or routes.tsx file. This does the check based on these two files only and the `routes` array variable content without doing any validation.

Hilla views are in use in following cases based on the `routes` array:
- If file does not contain `...serversideRoutes`
- If `routes` contains anything else in addition to `...serversideRoutes`
- If tsx has `...serversideRoutes` in MainLayout's `children` array
Hilla views are not used in following case:
- If `...serversideRoutes` is the only item

* chore: changes by code review findings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

3 participants