Skip to content

feat(iconset): resolve via package dependency, drop per-demo copies#45

Merged
JumpLink merged 2 commits into
mainfrom
feat/iconset-dist-resolution
Apr 15, 2026
Merged

feat(iconset): resolve via package dependency, drop per-demo copies#45
JumpLink merged 2 commits into
mainfrom
feat/iconset-dist-resolution

Conversation

@JumpLink
Copy link
Copy Markdown

Summary

  • @ribajs/iconset is now consumed purely as a package dependency. Vite resolves icon URLs through the package exports field, so demos no longer need a local public/iconset/ copy.
  • Package-level exports hide the dist/ segment from import URLs: use @ribajs/iconset/svg/<name>.svg?url (not src/ or dist/). The iconset build is mandatory again; clean actually cleans, and the Vite plugin throws with a clear hint if dist/svg/ is missing.
  • ribaIconsetPlugin is a named export of @ribajs/vite-config with configurable baseUrl / outputDir. infra/doc drops its duplicate plugin + /iconset alias and reuses the shared one (mounted at /iconset, matching existing doc references).
  • bs5-theme-button hardcoded /iconset/svg/icon_*.svg strings are replaced by ?url imports so Vite bundles (and hashes/inlines) them automatically.
  • Root yarn build / build:libs now run topologically (-t) so iconset builds before its consumers.

Test plan

  • yarn install succeeds
  • yarn workspace @ribajs/iconset clean && yarn workspace @ribajs/iconset build — regenerates 333 SVG + 1998 PNG
  • cd demos/bs5-theme && yarn build — succeeds; sun/moon icons appear inlined as data-URLs in the main bundle (confirming the ?url import path)
  • cd infra/doc && yarn build — succeeds; 333 icons emitted to _site/iconset/ without the /svg/ segment (matches doc page references)
  • cd packages/bs5 && yarn check — no type errors
  • CI: full build pipeline
  • Manual: start a few demos (bs5-dropdown, bs5-theme, iconset) and verify icons render in the browser

Elevate @ribajs/iconset to a proper package dependency that Vite resolves
automatically. Demos no longer need to carry their own public/iconset copy.

- packages/iconset: expose built assets through exports (./svg/*, ./png/*,
  ./svg.json, ./png.json) pointing into dist/, drop src/* export, make
  clean real, narrow files to /dist
- infra/vite-config: export ribaIconsetPlugin with configurable baseUrl /
  outputDir, resolve dist/svg, throw when iconset is unbuilt
- infra/doc: drop duplicate iconset plugin and alias, reuse shared plugin
  with /iconset mount; add @ribajs/vite-config devDependency
- packages/bs5: migrate bs5-theme-button hardcoded icon paths to ?url
  imports from @ribajs/iconset/svg/*; add iconset dependency
- root: enable topological workspace build ordering so iconset builds
  before consumers
…sages

- root: add `postinstall` that builds @ribajs/iconset, so CI (which always
  starts from a fresh install) has dist/svg/ available before build/test runs
- infra/vite-config: revert ribaIconsetPlugin to silent skip + one-time warn
  when dist/svg is missing; the previous throw broke demos that do not use
  iconset themselves (the Vite plugin is wired into all demos by default)
- demos/bs5-slider, demos/iconset: migrate `@ribajs/iconset/src/svg/...`
  imports and glob to `@ribajs/iconset/svg/...` to match the new exports map
@JumpLink JumpLink merged commit 24671c6 into main Apr 15, 2026
4 checks passed
@JumpLink JumpLink deleted the feat/iconset-dist-resolution branch April 15, 2026 14:25
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