Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ __pycache__/

# Build output
dist/
dist-site/
build/
out/
*.egg-info/
Expand Down
18 changes: 18 additions & 0 deletions scripts/build-site.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node
// Assemble the static landing site for static hosts (Vercel, Netlify, Pages).
// The full app needs a persistent Node server and a local SQLite database, so
// only the self-contained landing page ships to static hosting: land.html
// becomes index.html and brings its one script along.
import fs from 'node:fs';
import path from 'node:path';

const root = path.resolve(import.meta.dirname, '..');
const out = path.join(root, 'dist-site');
const files = { 'land.html': 'index.html', 'land.js': 'land.js' };

fs.rmSync(out, { recursive: true, force: true });
fs.mkdirSync(out, { recursive: true });
for (const [src, dest] of Object.entries(files)) {
fs.copyFileSync(path.join(root, 'public', src), path.join(out, dest));
}
console.log(`Static landing site written to ${out} (${Object.keys(files).length} files)`);
21 changes: 21 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"installCommand": "",
"buildCommand": "node scripts/build-site.mjs",
"outputDirectory": "dist-site",
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; form-action 'self'"
},
{ "key": "X-Content-Type-Options", "value": "nosniff" },
{ "key": "Referrer-Policy", "value": "no-referrer" },
{ "key": "Permissions-Policy", "value": "camera=(), microphone=(), geolocation=()" },
{ "key": "Cross-Origin-Resource-Policy", "value": "same-origin" }
]
}
]
}
Loading