Skip to content

Commit dab8a2e

Browse files
committed
feat(site): rewrite landing as Astro 5 + Svelte 5 for cleverkeys.app
Replaces the single-file Tailwind-CDN page under web_demo/ with a proper Astro project in site/. New landing ships a dark-first purple theme, a Svelte island phone mockup with an animated swipe-path demo, stats ribbon, feature grid, install tabs (copy-to-clipboard), language grid, and docs/demo CTAs. Wiki (43 markdown pages in docs/wiki/) now renders via Astro content collections with a shared sidebar layout, breadcrumbs, and tuned prose styles. A custom remark plugin rewrites every .md cross-reference to clean /wiki/<slug>/ routes (and /specs/*.html for spec pages), so internal wiki links no longer 404. Sitemap + robots added. Deploy workflow now installs with Bun, runs astro build, merges the legacy /demo/ and /specs/ HTML + ONNX assets into site/dist/, emits redirect shims for any old *.html wiki URLs, and reasserts the cleverkeys.app CNAME file. A stray broken wiki reference in troubleshooting/backup-restore.md was repaired. — opus 4.7
1 parent f5130dd commit dab8a2e

28 files changed

Lines changed: 2595 additions & 70 deletions
Lines changed: 86 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
name: Deploy CleverKeys Web Demo
1+
name: Deploy cleverkeys.app
22

33
on:
44
push:
5-
branches: [ main ]
6-
paths: [ 'web_demo/**', 'README.md', 'docs/wiki/**' ]
5+
branches: [main]
6+
paths:
7+
- 'site/**'
8+
- 'web_demo/**'
9+
- 'docs/wiki/**'
10+
- 'README.md'
11+
- '.github/workflows/deploy-web-demo.yml'
712
workflow_dispatch:
813

914
permissions:
@@ -12,12 +17,15 @@ permissions:
1217
id-token: write
1318

1419
concurrency:
15-
group: "pages"
20+
group: 'pages'
1621
cancel-in-progress: true
1722

1823
jobs:
1924
build:
2025
runs-on: ubuntu-latest
26+
defaults:
27+
run:
28+
working-directory: site
2129
steps:
2230
- name: Checkout
2331
uses: actions/checkout@v4
@@ -26,81 +34,90 @@ jobs:
2634

2735
- name: Ensure LFS files
2836
run: git lfs install && git lfs pull
37+
working-directory: .
2938

30-
- name: Prepare CleverKeys website and demo
39+
- name: Setup Bun
40+
uses: oven-sh/setup-bun@v2
41+
with:
42+
bun-version: latest
43+
44+
- name: Install site dependencies
45+
run: bun install --frozen-lockfile
46+
47+
- name: Build Astro site
48+
run: bun run build
49+
env:
50+
ASTRO_TELEMETRY_DISABLED: '1'
51+
52+
- name: Merge legacy demo & specs into dist
53+
working-directory: .
3154
run: |
32-
mkdir -p deploy/demo
33-
mkdir -p deploy/specs
34-
35-
if [ -d "web_demo" ]; then
36-
echo "📁 Setting up CleverKeys website..."
37-
38-
# Copy new homepage
39-
if [ -f "web_demo/index.html" ]; then
40-
cp web_demo/index.html deploy/
41-
echo "✅ Homepage ready"
42-
fi
43-
44-
# Copy demo page (use demo/index.html if exists, otherwise under construction)
45-
echo "📁 Setting up demo in /demo/..."
46-
if [ -f "web_demo/demo/index.html" ]; then
47-
cp web_demo/demo/index.html deploy/demo/index.html
48-
echo "✅ Demo page ready (under construction)"
49-
elif [ -f "web_demo/swipe-onnx.html" ]; then
50-
cp web_demo/swipe-onnx.html deploy/demo/index.html
51-
echo "✅ Demo page ready (neural swipe)"
52-
fi
53-
54-
# Copy specs documentation
55-
echo "📁 Setting up specs documentation in /specs/..."
56-
if [ -d "web_demo/specs" ]; then
57-
cp -r web_demo/specs/* deploy/specs/
58-
echo "✅ Specs documentation ready"
59-
fi
60-
61-
# Copy wiki user guide
62-
echo "📁 Setting up wiki user guide in /wiki/..."
63-
if [ -d "web_demo/wiki" ]; then
64-
mkdir -p deploy/wiki
65-
cp -r web_demo/wiki/* deploy/wiki/
66-
echo "✅ Wiki user guide ready (includes search-index.json)"
67-
fi
68-
69-
# Copy demo supporting files (for when demo is restored)
70-
echo "📁 Copying demo assets..."
71-
cp web_demo/*.onnx deploy/demo/ 2>/dev/null || echo "ℹ️ No ONNX models"
72-
cp web_demo/*.js deploy/demo/ 2>/dev/null || echo "ℹ️ No JS files"
73-
cp web_demo/*.json deploy/demo/ 2>/dev/null || echo "ℹ️ No JSON config files"
74-
cp web_demo/*.css deploy/demo/ 2>/dev/null || echo "ℹ️ No CSS files"
75-
76-
# Copy any font files
77-
cp web_demo/*.ttf deploy/demo/ 2>/dev/null || echo "ℹ️ No TTF fonts"
78-
cp web_demo/*.woff deploy/demo/ 2>/dev/null || echo "ℹ️ No WOFF fonts"
79-
cp web_demo/*.woff2 deploy/demo/ 2>/dev/null || echo "ℹ️ No WOFF2 fonts"
80-
81-
# Copy any image files
82-
cp web_demo/*.png deploy/demo/ 2>/dev/null || echo "ℹ️ No PNG images"
83-
cp web_demo/*.jpg deploy/demo/ 2>/dev/null || echo "ℹ️ No JPG images"
84-
cp web_demo/*.svg deploy/demo/ 2>/dev/null || echo "ℹ️ No SVG images"
55+
set -euo pipefail
56+
57+
# /demo/ — ONNX-powered swipe demo (self-contained legacy HTML)
58+
if [ -d "web_demo/demo" ]; then
59+
mkdir -p site/dist/demo
60+
cp -r web_demo/demo/. site/dist/demo/
61+
echo "✅ Copied web_demo/demo → site/dist/demo"
62+
elif [ -f "web_demo/swipe-onnx.html" ]; then
63+
mkdir -p site/dist/demo
64+
cp web_demo/swipe-onnx.html site/dist/demo/index.html
65+
fi
66+
67+
# Supporting assets referenced by the demo (ONNX, tokenizer, vocab, JS, fonts)
68+
for pattern in '*.onnx' '*.js' '*.json' '*.css' '*.ttf' '*.woff' '*.woff2' '*.png' '*.jpg' '*.svg'; do
69+
cp -n web_demo/$pattern site/dist/demo/ 2>/dev/null || true
70+
done
71+
72+
# /specs/ — technical specifications (static HTML snapshot)
73+
if [ -d "web_demo/specs" ]; then
74+
mkdir -p site/dist/specs
75+
cp -r web_demo/specs/. site/dist/specs/
76+
echo "✅ Copied web_demo/specs → site/dist/specs"
8577
fi
8678
87-
echo ""
88-
echo "✅ Website structure prepared:"
89-
echo " / - Homepage"
90-
echo " /demo/ - Demo (under construction)"
91-
echo " /specs/ - Technical specifications"
92-
echo " /wiki/ - User guide wiki (with search-index.json)"
93-
echo ""
94-
echo "📊 Deployed files:"
95-
ls -laR deploy/
79+
# Backwards-compatible redirects for any old .html wiki URLs that
80+
# might be cached or linked externally.
81+
# The new wiki routes omit .html and lowercase path segments.
82+
if [ -d "web_demo/wiki" ]; then
83+
find web_demo/wiki -type f -name "*.html" | while read f; do
84+
rel="${f#web_demo/wiki/}"
85+
# /wiki/foo/bar.html -> /wiki/foo/bar/
86+
slug="${rel%.html}"
87+
slug_lower="$(echo "$slug" | tr '[:upper:]' '[:lower:]')"
88+
target="/wiki/${slug_lower}/"
89+
# Skip if a file with this exact path already exists in dist
90+
if [ -f "site/dist/wiki/${rel}" ]; then
91+
continue
92+
fi
93+
mkdir -p "site/dist/wiki/$(dirname "$rel")"
94+
cat > "site/dist/wiki/${rel}" <<EOF
95+
<!doctype html><meta charset="utf-8">
96+
<title>Redirecting…</title>
97+
<link rel="canonical" href="${target}">
98+
<meta http-equiv="refresh" content="0;url=${target}">
99+
<p>Redirecting to <a href="${target}">${target}</a>.</p>
100+
EOF
101+
done
102+
fi
103+
104+
# CNAME lives in site/public/ and is copied automatically by Astro,
105+
# but we reassert it here so the deploy artifact always has it.
106+
echo "cleverkeys.app" > site/dist/CNAME
107+
108+
echo "---"
109+
echo "📊 Deploy tree:"
110+
find site/dist -maxdepth 2 -type d | sort
111+
echo "---"
112+
echo "📦 Total size: $(du -sh site/dist | cut -f1)"
96113
97114
- name: Configure Pages
98115
uses: actions/configure-pages@v5
99116

100117
- name: Upload Pages artifact
101118
uses: actions/upload-pages-artifact@v3
102119
with:
103-
path: ./deploy
120+
path: ./site/dist
104121

105122
deploy:
106123
environment:
@@ -111,4 +128,4 @@ jobs:
111128
steps:
112129
- name: Deploy to GitHub Pages
113130
id: deployment
114-
uses: actions/deploy-pages@v4
131+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ src/main/assets/prefix_boosts/*.json
121121
pal_generated.code
122122
# Temp emoji data files
123123
*.json
124+
!site/**/*.json
125+
!site/package.json
126+
!site/tsconfig.json
124127
generated_*.kt
125128
.env
126129

docs/wiki/troubleshooting/backup-restore.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,5 @@ Exported files are saved to the location you choose via Android's file picker (t
230230
## Related Topics
231231

232232
- [Privacy](../settings/privacy.md) - Data collection settings
233-
- [Per-Key Customization](../customization/custom-layouts.md) - Subkey settings
233+
- [Per-Key Customization](../customization/per-key-actions.md) - Subkey settings
234+
- [Custom Layouts](../layouts/custom-layouts.md) - Build your own keyboard layout

memory/todo.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# CleverKeys TODO
22

3+
## ✅ Landing site rewrite: Astro 5 + Svelte 5 + Tailwind v4 (2026-04-17)
4+
5+
Fully replaced the old single-file `web_demo/index.html` with a proper Astro
6+
project under `site/`. New landing matches `svelte-landing-page` + `impeccable`
7+
skill guidance: dark-first purple brand, custom SVG phone mockup with animated
8+
swipe-path demo as a Svelte island, stats ribbon, feature grid, install tabs
9+
(copy-to-clipboard island), language grid, demo/docs CTAs.
10+
11+
Wiki (43 pages) migrated to Astro content collections sourced from
12+
`docs/wiki/**/*.md`. Shared `WikiLayout` with section sidebar, breadcrumbs, new
13+
prose styling. Custom remark plugin rewrites all `.md` cross-refs to clean
14+
`/wiki/<slug>/` routes and redirects spec references to `/specs/…html`.
15+
16+
Custom domain: `site/public/CNAME = cleverkeys.app`. Workflow
17+
(`.github/workflows/deploy-web-demo.yml`) rewritten to install deps with Bun,
18+
run `astro build`, merge legacy `/demo/` and `/specs/` HTML + assets into
19+
`site/dist/`, and emit redirect shims for any old `.html` wiki URLs so external
20+
links don't 404. Fixed a broken wiki reference
21+
(`customization/custom-layouts.md` → split into per-key-actions + custom-layouts).
22+
23+
- Site root: `site/` (Astro 5.18, Svelte 5.55, Tailwind 4.2, sitemap integration)
24+
- Build: `cd site && bun install && bun run build``site/dist/`
25+
- **Manual step**: Set "Custom domain" to `cleverkeys.app` in repo
26+
Settings → Pages (CNAME file handles the certificate).
27+
328
## ✅ Memory/Performance Optimization (2026-04-09, continued 2026-04-10)
429

530
### VocabularyTrie Compact Nodes (f183e1515)

site/.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# dependencies (bun install)
2+
node_modules
3+
4+
# astro build output
5+
dist
6+
.astro
7+
out
8+
*.tgz
9+
10+
# code coverage
11+
coverage
12+
*.lcov
13+
14+
# logs
15+
logs
16+
_.log
17+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
18+
19+
# dotenv environment variable files
20+
.env
21+
.env.development.local
22+
.env.test.local
23+
.env.production.local
24+
.env.local
25+
26+
# caches
27+
.eslintcache
28+
.cache
29+
*.tsbuildinfo
30+
31+
# IntelliJ based IDEs
32+
.idea
33+
34+
# Finder (MacOS) folder config
35+
.DS_Store

site/astro.config.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// @ts-check
2+
import { defineConfig } from 'astro/config'
3+
import svelte from '@astrojs/svelte'
4+
import sitemap from '@astrojs/sitemap'
5+
import tailwind from '@tailwindcss/vite'
6+
import remarkWikiLinks from './src/lib/remark-wiki-links.mjs'
7+
8+
// https://astro.build/config
9+
export default defineConfig({
10+
site: 'https://cleverkeys.app',
11+
integrations: [svelte(), sitemap()],
12+
vite: {
13+
plugins: [tailwind()],
14+
},
15+
markdown: {
16+
remarkPlugins: [remarkWikiLinks],
17+
shikiConfig: {
18+
theme: 'one-dark-pro',
19+
wrap: true,
20+
},
21+
},
22+
build: {
23+
inlineStylesheets: 'auto',
24+
},
25+
compressHTML: true,
26+
})

0 commit comments

Comments
 (0)