Repository navigation
Read runtime icons from every loaded application's manifest - #4
Merged
Merged
Conversation
Only one manifest was read per node: the host application's in development, or the first loaded application shipping one in a release. A library using icons in its own components could not ship them, since the host's compiler scans only the host's sources and the library's manifest was never read. At runtime, icons now come from the manifests of every loaded application, sorted by name, with the application's own manifest last so it wins on conflicts. Applications without a code path are skipped rather than resolved against the working directory. The compiler and the mix tasks still read and write only the project's own manifest, and add_icon/3 with persist: true writes the own manifest plus the new icon instead of the merged runtime set, so a host never copies a library's icons into its manifest.
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.
Only one manifest was read per node: the host application's in development, or the first loaded application shipping one in a release. A library that uses icons in its own components could not ship them. The host's compiler scans only the host's sources, and the library's own manifest was never read.
I hit this adding icons to PhoenixReplay's dashboard, which renders inside host applications.
Change
get_icons/0andreload/0merge the manifests of loaded applications, sorted by name, with the application's own manifest last so it wins on conflicts. A library now shipspriv/iconify/manifest.json, and hosts need no configuration.priv/against the working directory.mix phoenix_iconify.*tasks are unchanged: they read and write only the current project's own manifest.add_icon/3withpersist: truewrites the application's own manifest plus the new icon. It used to write the merged runtime set, which would copy a library's icons into the host's manifest.Manifest.read_all/1andManifest.manifest_paths/0expose the merged view.files. CHANGELOG: Unreleased entries.Tests
library_manifests_test.exsloads fixture applications with their ownpriv/iconify/manifest.jsonon the code path. It covers merge precedence, a library's icons rendering with the host winning on a clash, andadd_icon/3persisting only the own icons. Makingget_icons/0read only the own manifest, or persisting the merged set, each fails a test.mix cipasses.