From d7d4bbc099aaddcb2baf52e0ccf831f7bce77971 Mon Sep 17 00:00:00 2001 From: josh Date: Sat, 28 Mar 2026 02:08:58 -0400 Subject: [PATCH] fixes version not showing up in web ui --- .dockerignore | 3 +++ .gitignore | 1 + Dockerfile | 3 +++ index.html | 1 + js/app.js | 5 +---- package.json | 5 +++-- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.dockerignore b/.dockerignore index 8d49741..aff0042 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,6 @@ Dockerfile .dockerignore docker-compose.yml +node_modules +tests +vitest.config.js diff --git a/.gitignore b/.gitignore index c2658d7..0045a54 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules/ +js/version.js diff --git a/Dockerfile b/Dockerfile index ff02415..1febd11 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,6 @@ FROM nginx:alpine COPY nginx.conf /etc/nginx/conf.d/default.conf COPY . /usr/share/nginx/html +RUN awk -F'"' '/"version"/{printf "const VERSION = \"%s\";\n", $4; exit}' \ + /usr/share/nginx/html/package.json \ + > /usr/share/nginx/html/js/version.js diff --git a/index.html b/index.html index 404a2c4..5d1e275 100644 --- a/index.html +++ b/index.html @@ -177,6 +177,7 @@ + diff --git a/js/app.js b/js/app.js index f989686..288d202 100644 --- a/js/app.js +++ b/js/app.js @@ -37,10 +37,7 @@ window.addEventListener('popstate', e => { // ── Bootstrap ───────────────────────────────────────────────────────────────── -fetch('/package.json') - .then(r => r.json()) - .then(pkg => { document.getElementById('nav-version').textContent = `v${pkg.version}`; }) - .catch(() => {}); +if (VERSION) document.getElementById('nav-version').textContent = `v${VERSION}`; initDB().then(() => { renderDashboard(); diff --git a/package.json b/package.json index 23a79e9..02cff78 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,11 @@ { "name": "catalyst", - "version": "1.0.2", + "version": "1.0.3", "type": "module", "scripts": { "test": "vitest run", - "test:watch": "vitest" + "test:watch": "vitest", + "version:write": "node -e \"const {version}=JSON.parse(require('fs').readFileSync('package.json','utf8'));require('fs').writeFileSync('js/version.js','const VERSION = \\\"'+version+'\\\";\\n');\"" }, "devDependencies": { "vitest": "^2.0.0",