Repository navigation
chore(version): centralize plugin version + add drift guard - #16
Merged
Merged
Conversation
Make package.json the single source of truth for the plugin version so it can't go stale in multiple places again: - Front-end: Vite `define` injects the version into a new src/ts/version.ts (MODERNUI_VERSION). shell-user-menu now imports it instead of a hardcoded `const VERSION = '0.4.2'`, and its About link's placeholder EXAMPLE URL is fixed to the real repo. vitest mirrors the same define so tests resolve it identically. - PHP pages: build emits package/version (gitignored) from package.json, read at render time by modernui_plugin_version(). Theme.page's About footer shows the real version instead of the hardcoded "Modern UI v0.7.0 (Phase 7)". Add tools/check-version-sync.mjs (`npm run version:check`): fails if package.json, package-lock.json (root + packages[""]), and the .plg <!ENTITY version> drift. Wired into CI and release before the test steps. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`biome ci` in the lint job flagged the new single-line version read as exceeding the line width. Apply Biome's formatting (multi-line call) so the lint job passes; no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What & why
The plugin version was hardcoded in several disconnected places, so it drifted: the Settings → Theme "About" footer still read Modern UI v0.7.0 (Phase 7) and the shell user-menu read v0.4.2, while the plugin is at v0.8.x. This makes
package.jsonthe single source of truth and adds a guard so the remaining literals can't silently drift again.Changes
Front-end (TS/Lit)
src/ts/version.tsexportsMODERNUI_VERSION, fed by a Vitedefine(__MODERNUI_VERSION__) frompackage.jsonin bothtools/build.mjsandvitest.config.ts— one source for build and tests.shell-user-menu.tsimports it instead ofconst VERSION = '0.4.2', and its About link's placeholdergithub.com/EXAMPLE/…URL is corrected to the real repo.PHP pages
tools/build.mjsemitspackage/version(gitignored, ships in the txz) frompackage.json.modernui_plugin_version()inhelpers.phpreads it;Theme.page's About footer renders the real version (htmlspecialchars-escaped) instead of the hardcodedv0.7.0 (Phase 7)..plg<!ENTITY version>necessarily stays a literal (Unraid parses it before any code runs); the new guard keeps it honest.Drift guard
tools/check-version-sync.mjs(npm run version:check) fails ifpackage.json,package-lock.json(root +packages[""]), and the.plg<!ENTITY version>disagree. Wired into CI and release before the test steps.Verification
npm run version:check→ all four in sync at 0.8.3; forcing a mismatch exits 1 naming the culprit.npm run build→ bundle containsModern UI v${…}→0.8.3; no0.4.2/EXAMPLEliterals remain.tsc --noEmitshows no new errors. PHPhelpers.test.phppasses (the one pre-existingsave-docker-autostartfailure is an unrelated Windows-only flake).🤖 Generated with Claude Code