Add SPA static file serving from backend

Backend (Server.hs):
- serveStaticOrSpa: serves static files from --static-dir
- SPA fallback: extensionless paths serve index.html
- MIME type mapping for html/css/js/png/svg/ico/woff2

Frontend:
- ES module imports with import map for Mithril CDN
- Build script: tsc + copy index.html + static assets

CLI:
- --static-dir flag (default: frontend/dist)
- scripts/run passes through extra args
- Dockerfile CMD points at /usr/local/share/sis/static
This commit is contained in:
2026-07-15 14:59:31 -04:00
parent 5075ef2718
commit 72b1ee1d3d
12 changed files with 1297 additions and 114 deletions
+8 -1
View File
@@ -6,9 +6,16 @@
<title>Sis — Chore Tracker</title>
<link rel="stylesheet" href="https://unpkg.com/neobrutalismcss@latest">
<link rel="stylesheet" href="/style.css">
<script type="importmap">
{
"imports": {
"mithril": "https://unpkg.com/mithril@2.2.13/mithril.min.js"
}
}
</script>
</head>
<body>
<div id="app"></div>
<script src="/index.js"></script>
<script type="module" src="/index.js"></script>
</body>
</html>
+1089
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -4,7 +4,7 @@
"private": true,
"description": "Sis chore tracker SPA frontend",
"scripts": {
"build": "tsc && cp -r public/* dist/",
"build": "tsc && cp index.html dist/ && cp -r public/* dist/",
"dev": "tsc --watch",
"serve": "npx serve dist"
},