Skip to content

feat(icons): auto-register icons used by library components#523

Merged
kelsos merged 1 commit intorotki:mainfrom
kelsos:feat/library-baseline-icons
Apr 28, 2026
Merged

feat(icons): auto-register icons used by library components#523
kelsos merged 1 commit intorotki:mainfrom
kelsos:feat/library-baseline-icons

Conversation

@kelsos
Copy link
Copy Markdown
Member

@kelsos kelsos commented Apr 28, 2026

Summary

Library-internal icons (e.g. lu-calendar-days in RuiDateTimePicker, lu-clock in RuiTimePicker, the dozens used by RuiCalendar, RuiCheckbox, RuiDataTable, etc.) were never registered automatically — every consumer would have to add them via the plugin's include option, or hit a runtime "Icons "..." not found" warning the first time the component rendered.

Now:

  • A new scripts/scan-library-icons.ts step (run from dist-build.mjs after web-types) scans src/components/**/*.{vue,ts} (excluding specs/stories) and writes the validated icon list to dist/library-icons.json.
  • ruiIconsPlugin reads dist/library-icons.json at configResolved and seeds its scanResult.icons with this baseline.
  • Net effect: every consumer gets all 30 library-baseline icons for free, on top of whatever the plugin auto-detects in their own source and whatever they pass via include.

Verified the example app's plugin now logs Loaded 30 baseline icons used by library components and the detected-icon count went from 31 → 56.

Test plan

  • pnpm run typecheck clean
  • pnpm -w run lint clean
  • pnpm --filter @rotki/ui-library run test:run (1072 pass)
  • pnpm run test:e2e (280 pass)
  • pnpm --filter @rotki/ui-library run build:prod emits dist/library-icons.json
  • Example app picks up baseline (verified via plugin debug log)

Scan src/components at library build time and emit dist/library-icons.json
with every icon name referenced by library components. The vite plugin
seeds its scanResult with this baseline at configResolved, so consumers
of components like RuiDateTimePicker (lu-calendar-days), RuiTimePicker
(lu-clock), or any other library component never need to register those
icons themselves.
@kelsos kelsos requested a review from a team as a code owner April 28, 2026 13:31
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 28, 2026

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.73%. Comparing base (7bc9bb8) to head (41038be).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/ui-library/src/vite-plugin/index.ts 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #523      +/-   ##
==========================================
- Coverage   84.89%   84.73%   -0.17%     
==========================================
  Files         143      143              
  Lines        5217     5227      +10     
  Branches     1554     1556       +2     
==========================================
  Hits         4429     4429              
- Misses        788      798      +10     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kelsos kelsos merged commit 41038be into rotki:main Apr 28, 2026
4 checks passed
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