fixes version not showing up in web ui
All checks were successful
Build / test (push) Successful in 9m28s
Build / release (push) Successful in 1s
Build / build (push) Successful in 18s

This commit is contained in:
2026-03-28 02:08:58 -04:00
parent aeb5fa4fb7
commit d7d4bbc099
6 changed files with 12 additions and 6 deletions

View File

@@ -3,3 +3,6 @@
Dockerfile
.dockerignore
docker-compose.yml
node_modules
tests
vitest.config.js

1
.gitignore vendored
View File

@@ -1 +1,2 @@
node_modules/
js/version.js

View File

@@ -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

View File

@@ -177,6 +177,7 @@
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.10.2/sql-wasm.js"></script>
<script src="js/version.js" onerror="window.VERSION=null"></script>
<script src="js/config.js"></script>
<script src="js/db.js"></script>
<script src="js/ui.js"></script>

View File

@@ -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();

View File

@@ -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",