Show a version number at the top of the page (Ver YYMMDDX) #15

Closed
opened 2026-11-09 23:57:16 +00:00 by eric · 1 comment
Owner

Show the app's version in the top bar, to the right of the Last update date, e.g. Ver 261109B.

Format

Ver YYMMDDX: YYMMDD is the date of the version, X is the iteration on that date: A = first, B = second, and so on. 26 per day at most (A-Z).

Behavior

  • The version is the version of the app code, not of the data. It is baked into the build, so a file saved with newer code shows the newer version. That also makes it a quick check that opening an older file in a newer build (the upgrade path) really took effect.
  • Shown in the top bar right after Last update: YYYY-MM-DD, in the same muted style.
  • Not part of the document or the encrypted payload; no schema change.

Implementation

  1. src/version.js: APP_VERSION = '261109A' plus pure helpers isVersion(v) and nextVersion(current, date) (same date -> next letter; new date -> A; error past Z). Added to the bundle in build.js.
  2. bump-version.js + npm run bump: rewrites src/version.js using today's local date and nextVersion. Also the engine of the pre-commit hook.
  3. src/app.js: render Ver <APP_VERSION> in the top bar after the Last update span.
  4. Docs: MAINTENANCE.md (how versions work, when to bump), README, OVERVIEW.md.

Tests

  • Integration: a temp git repo with the hook installed (first commit untouched, docs-only no bump, app change bumps inside the commit, second change B, hand bump respected, overflow past Z keeps Z).
  • Unit: format check, nextVersion (same day, new day, Z overflow, bad input), the committed APP_VERSION is valid, and the built HTML contains it.
  • Headless Chromium: after unlock the top bar reads Last update: ... Ver 261109A with the version after the date.

Notes

  • Automatic bump (added): a git pre-commit hook (.githooks/pre-commit, enabled per clone with npm run hooks) runs bump-version.js --staged. Any commit that changes src/ or build.js gets the next version automatically, inside that same commit. Docs-only/test-only commits don't bump; a commit that already changes the version by hand is left alone; past Z it warns and keeps Z. npm run bump still works by hand.
  • One bump per commit, not per edit, so the letter counts commits that change the app on that day.
Show the app's version in the top bar, to the right of the Last update date, e.g. **Ver 261109B**. ## Format `Ver YYMMDDX`: YYMMDD is the date of the version, X is the iteration on that date: A = first, B = second, and so on. 26 per day at most (A-Z). ## Behavior - The version is the version of the **app code**, not of the data. It is baked into the build, so a file saved with newer code shows the newer version. That also makes it a quick check that opening an older file in a newer build (the upgrade path) really took effect. - Shown in the top bar right after `Last update: YYYY-MM-DD`, in the same muted style. - Not part of the document or the encrypted payload; no schema change. ## Implementation 1. `src/version.js`: `APP_VERSION = '261109A'` plus pure helpers `isVersion(v)` and `nextVersion(current, date)` (same date -> next letter; new date -> A; error past Z). Added to the bundle in `build.js`. 2. `bump-version.js` + `npm run bump`: rewrites `src/version.js` using today's local date and `nextVersion`. Also the engine of the pre-commit hook. 3. `src/app.js`: render `Ver <APP_VERSION>` in the top bar after the Last update span. 4. Docs: MAINTENANCE.md (how versions work, when to bump), README, OVERVIEW.md. ## Tests - Integration: a temp git repo with the hook installed (first commit untouched, docs-only no bump, app change bumps inside the commit, second change B, hand bump respected, overflow past Z keeps Z). - Unit: format check, `nextVersion` (same day, new day, Z overflow, bad input), the committed `APP_VERSION` is valid, and the built HTML contains it. - Headless Chromium: after unlock the top bar reads `Last update: ... Ver 261109A` with the version after the date. ## Notes - **Automatic bump (added):** a git pre-commit hook (`.githooks/pre-commit`, enabled per clone with `npm run hooks`) runs `bump-version.js --staged`. Any commit that changes `src/` or `build.js` gets the next version automatically, inside that same commit. Docs-only/test-only commits don't bump; a commit that already changes the version by hand is left alone; past Z it warns and keeps Z. `npm run bump` still works by hand. - One bump per commit, not per edit, so the letter counts commits that change the app on that day.
eric closed this issue 2026-11-10 00:01:34 +00:00
Author
Owner

Implemented in a2fcc65.

Added

  • The top bar shows Ver YYMMDDX (currently Ver 261109A) right after the Last update date, in the same muted style. Confirmed in a real browser: same row, version to the right of the date.
  • It is the version of the app code, not the data: baked into the build via src/version.js (APP_VERSION), not part of the document or encrypted payload. A file saved from a newer build shows the newer version, so after upgrading an old file you can check it took effect.
  • Automatic bump: a git pre-commit hook (.githooks/pre-commit running bump-version.js --staged) moves the version to today's date with the next letter inside any commit that changes src/ or build.js. Docs-only and test-only commits don't bump; a hand-bumped version is left alone; past Z it warns and keeps Z. npm run bump still bumps by hand. The letter counts commits that change the app that day, not edits.
  • The hook must be switched on once per clone with npm run hooks (sets core.hooksPath). It is on in the owner's clone.
  • build.js no longer runs a build when imported (needed so tests can import it).
  • Docs: MAINTENANCE.md, README, OVERVIEW.md (OVERVIEW.md went in separately as 3c347c4).

Verified

  • Unit tests: 52 (51 pass, 1 skipped as before). New: version format, nextVersion rules (same day, new day, past Z, bad input), the built bundle carries the version, needsBump rules.
  • Integration test with a real temp git repo and the hook installed: first commit untouched, docs-only no bump, app change bumps inside that commit, next change B, hand bump respected, overflow keeps Z, working tree clean after each commit.
  • Headless Chromium: top bar reads the date then Ver 261109A.

Notes / not done

  • This first commit shipped 261109A as is (the version file was new); the next app-changing commit becomes 261109B.
  • git commit <paths> leaves the bump out of that commit; use git add … && git commit or git commit -a.
  • Not added to the unlock screen or the printed header (only the top of the page was requested).
  • Another clone needs npm run hooks before commits are bumped there.
Implemented in a2fcc65. **Added** - The top bar shows `Ver YYMMDDX` (currently `Ver 261109A`) right after the Last update date, in the same muted style. Confirmed in a real browser: same row, version to the right of the date. - It is the version of the app code, not the data: baked into the build via `src/version.js` (`APP_VERSION`), not part of the document or encrypted payload. A file saved from a newer build shows the newer version, so after upgrading an old file you can check it took effect. - **Automatic bump:** a git pre-commit hook (`.githooks/pre-commit` running `bump-version.js --staged`) moves the version to today's date with the next letter inside any commit that changes `src/` or `build.js`. Docs-only and test-only commits don't bump; a hand-bumped version is left alone; past Z it warns and keeps Z. `npm run bump` still bumps by hand. The letter counts commits that change the app that day, not edits. - The hook must be switched on once per clone with `npm run hooks` (sets core.hooksPath). It is on in the owner's clone. - `build.js` no longer runs a build when imported (needed so tests can import it). - Docs: MAINTENANCE.md, README, OVERVIEW.md (OVERVIEW.md went in separately as 3c347c4). **Verified** - Unit tests: 52 (51 pass, 1 skipped as before). New: version format, nextVersion rules (same day, new day, past Z, bad input), the built bundle carries the version, needsBump rules. - Integration test with a real temp git repo and the hook installed: first commit untouched, docs-only no bump, app change bumps inside that commit, next change B, hand bump respected, overflow keeps Z, working tree clean after each commit. - Headless Chromium: top bar reads the date then `Ver 261109A`. **Notes / not done** - This first commit shipped `261109A` as is (the version file was new); the next app-changing commit becomes `261109B`. - `git commit <paths>` leaves the bump out of that commit; use `git add … && git commit` or `git commit -a`. - Not added to the unlock screen or the printed header (only the top of the page was requested). - Another clone needs `npm run hooks` before commits are bumped there.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: eric/final-wishes#15
No description provided.