feat(iconset): resolve via package dependency, drop per-demo copies#45
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@ribajs/iconsetis now consumed purely as a package dependency. Vite resolves icon URLs through the packageexportsfield, so demos no longer need a localpublic/iconset/copy.exportshide thedist/segment from import URLs: use@ribajs/iconset/svg/<name>.svg?url(notsrc/ordist/). The iconset build is mandatory again;cleanactually cleans, and the Vite plugin throws with a clear hint ifdist/svg/is missing.ribaIconsetPluginis a named export of@ribajs/vite-configwith configurablebaseUrl/outputDir.infra/docdrops its duplicate plugin +/iconsetalias and reuses the shared one (mounted at/iconset, matching existing doc references).bs5-theme-buttonhardcoded/iconset/svg/icon_*.svgstrings are replaced by?urlimports so Vite bundles (and hashes/inlines) them automatically.yarn build/build:libsnow run topologically (-t) so iconset builds before its consumers.Test plan
yarn installsucceedsyarn workspace @ribajs/iconset clean && yarn workspace @ribajs/iconset build— regenerates 333 SVG + 1998 PNGcd demos/bs5-theme && yarn build— succeeds; sun/moon icons appear inlined as data-URLs in the main bundle (confirming the?urlimport 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 errorsbs5-dropdown,bs5-theme,iconset) and verify icons render in the browser