feat: show dev-<sha> version string in nav for dev builds
Production images continue to display the semver (v1.x.x). Dev images built by CI now receive BUILD_VERSION=dev-<7-char-sha> via a Docker ARG, and app.js skips the v prefix for non-semver strings. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -115,6 +115,24 @@ describe('fmtDateFull', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// ── versionLabel() ───────────────────────────────────────────────────────────
|
||||
// Mirrors the logic in app.js — semver strings get a v prefix, dev strings don't.
|
||||
|
||||
function versionLabel(v) {
|
||||
return /^\d/.test(v) ? `v${v}` : v
|
||||
}
|
||||
|
||||
describe('version label formatting', () => {
|
||||
it('prepends v for semver strings', () => {
|
||||
expect(versionLabel('1.1.2')).toBe('v1.1.2')
|
||||
expect(versionLabel('2.0.0')).toBe('v2.0.0')
|
||||
})
|
||||
|
||||
it('does not prepend v for dev build strings', () => {
|
||||
expect(versionLabel('dev-abc1234')).toBe('dev-abc1234')
|
||||
})
|
||||
})
|
||||
|
||||
// ── CSS regressions ───────────────────────────────────────────────────────────
|
||||
|
||||
const css = readFileSync(join(__dirname, '../css/app.css'), 'utf8')
|
||||
@@ -127,3 +145,15 @@ describe('CSS regressions', () => {
|
||||
expect(css).toMatch(/\.badge\s*\{[^}]*text-align\s*:\s*center/s)
|
||||
})
|
||||
})
|
||||
|
||||
// ── CI workflow regressions ───────────────────────────────────────────────────
|
||||
|
||||
const ciYml = readFileSync(join(__dirname, '../.gitea/workflows/ci.yml'), 'utf8')
|
||||
|
||||
describe('CI workflow regressions', () => {
|
||||
it('build-dev job passes BUILD_VERSION build arg', () => {
|
||||
// Regression: dev image showed semver instead of dev-<sha> because
|
||||
// BUILD_VERSION was never passed to docker build.
|
||||
expect(ciYml).toContain('BUILD_VERSION')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user