File size: 853 Bytes
cc6b6d8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | // The app version, from version.json (the single source of truth). Shown in the About footer,
// returned by window.unroll.version() and kept on window.UNROLL_VERSION for add-ons such as the Bench export.
import { API_VERSION } from './apispec.js';
export const VERSION = fetch(new URL('../version.json', import.meta.url), { cache: 'no-cache' })
.then((r) => (r.ok ? r.json() : Promise.reject(new Error(`version.json: HTTP ${r.status}`))))
.then((v) => ({ version: v.version, date: v.date, sha: v.sha, api: API_VERSION }))
.catch(() => ({ version: 'unknown', date: null, sha: null, api: API_VERSION }))
.then((v) => {
window.UNROLL_VERSION = Object.freeze(v);
const el = document.getElementById('aVersion');
if (el) el.textContent = `v${v.version}${v.sha ? ` · ${v.sha}` : ''}${v.date ? ` · ${v.date}` : ''}`;
return v;
});
|