Skip to content

Commit 44bf2aa

Browse files
matthew leanmatthew lean
authored andcommitted
feat: build BackWords as a Progressive Web App
- React 18 + Vite 6 + TypeScript (strict) SPA - vite-plugin-pwa (Workbox): service worker, offline-first, install prompt - BrowserRouter with basename=/BackWords for GitHub Pages - 7 routes: Home, Result, Timeline, SourceDetail, Settings, KnowledgePage, PassageView - Netlify Functions v2 (TypeScript): interpret, explain-source, pages, health - XAI grok-3-mini-fast for INTERPRET and EXPLAIN (MOCK + LIVE modes) - Design system: 3 palettes × light/dark, CSS custom properties, WCAG AA - 7 page components + 8 shared components - Vitest unit tests (7 passing) + Playwright E2E (22 tests, 24 screenshots) - GitHub Actions CI (lint/test/build/e2e) + deploy to gh-pages
1 parent db3b644 commit 44bf2aa

110 files changed

Lines changed: 16476 additions & 3185 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop, 'feature/**']
6+
pull_request:
7+
branches: [main]
8+
9+
defaults:
10+
run:
11+
working-directory: pwa
12+
13+
jobs:
14+
lint-typecheck:
15+
name: Lint & Type-check
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
cache: 'npm'
24+
cache-dependency-path: pwa/package-lock.json
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Lint
30+
run: npm run lint
31+
32+
- name: Type-check
33+
run: npm run typecheck
34+
35+
unit-tests:
36+
name: Unit & Component Tests
37+
runs-on: ubuntu-latest
38+
needs: lint-typecheck
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- uses: actions/setup-node@v4
43+
with:
44+
node-version: '20'
45+
cache: 'npm'
46+
cache-dependency-path: pwa/package-lock.json
47+
48+
- name: Install dependencies
49+
run: npm ci
50+
51+
- name: Run unit tests
52+
run: npm run test:unit -- --reporter=verbose
53+
54+
build:
55+
name: Production Build
56+
runs-on: ubuntu-latest
57+
needs: lint-typecheck
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- uses: actions/setup-node@v4
62+
with:
63+
node-version: '20'
64+
cache: 'npm'
65+
cache-dependency-path: pwa/package-lock.json
66+
67+
- name: Install dependencies
68+
run: npm ci
69+
70+
- name: Build
71+
run: npm run build
72+
env:
73+
VITE_BASE_PATH: /BackWords
74+
75+
- name: Upload build artifact
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: dist
79+
path: pwa/dist
80+
retention-days: 7
81+
82+
e2e-tests:
83+
name: E2E Tests (Playwright + Screenshots)
84+
runs-on: ubuntu-latest
85+
needs: build
86+
steps:
87+
- uses: actions/checkout@v4
88+
89+
- uses: actions/setup-node@v4
90+
with:
91+
node-version: '20'
92+
cache: 'npm'
93+
cache-dependency-path: pwa/package-lock.json
94+
95+
- name: Install dependencies
96+
run: npm ci
97+
98+
- name: Install Playwright browsers
99+
run: npx playwright install --with-deps chromium
100+
101+
- name: Download build artifact
102+
uses: actions/download-artifact@v4
103+
with:
104+
name: dist
105+
path: pwa/dist
106+
107+
- name: Run E2E tests against built app
108+
run: npm run test:e2e
109+
env:
110+
PLAYWRIGHT_BASE_URL: http://localhost:4173
111+
VITE_BASE_PATH: /BackWords
112+
VITE_API_BASE_URL: http://localhost:8888/.netlify/functions
113+
114+
- name: Upload screenshots
115+
if: always()
116+
uses: actions/upload-artifact@v4
117+
with:
118+
name: playwright-screenshots
119+
path: pwa/test-results/screenshots/
120+
retention-days: 30
121+
122+
- name: Upload Playwright report
123+
if: always()
124+
uses: actions/upload-artifact@v4
125+
with:
126+
name: playwright-report
127+
path: pwa/playwright-report/
128+
retention-days: 30

.github/workflows/deploy.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pages: write
11+
12+
defaults:
13+
run:
14+
working-directory: pwa
15+
16+
jobs:
17+
deploy:
18+
name: Build & Deploy
19+
runs-on: ubuntu-latest
20+
concurrency:
21+
group: gh-pages-deploy
22+
cancel-in-progress: true
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: '20'
31+
cache: 'npm'
32+
cache-dependency-path: pwa/package-lock.json
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Type-check
38+
run: npm run typecheck
39+
40+
- name: Build
41+
run: npm run build
42+
env:
43+
VITE_BASE_PATH: /BackWords
44+
VITE_API_BASE_URL: ${{ secrets.VITE_API_BASE_URL }}
45+
46+
- name: Deploy to gh-pages branch
47+
uses: peaceiris/actions-gh-pages@v4
48+
with:
49+
github_token: ${{ secrets.GITHUB_TOKEN }}
50+
publish_dir: ./pwa/dist
51+
publish_branch: gh-pages
52+
cname: ''
53+
force_orphan: false
54+
user_name: 'github-actions[bot]'
55+
user_email: 'github-actions[bot]@users.noreply.github.com'
56+
commit_message: 'deploy: ${{ github.sha }}'

.gitignore

Lines changed: 37 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,48 @@
1-
# Xcode
2-
#
3-
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
1+
# Dependencies
2+
node_modules/
3+
pwa/node_modules/
44

5-
## User settings
6-
xcuserdata/
5+
# Build outputs
6+
pwa/dist/
7+
pwa/dist-placeholder/
78

8-
## Obj-C/Swift specific
9-
*.hmap
10-
11-
## App packaging
12-
*.ipa
13-
*.dSYM.zip
14-
*.dSYM
9+
# Environment — NEVER commit secrets
10+
.env
11+
.env.local
12+
.env.*.local
13+
pwa/.env
14+
pwa/.env.local
15+
pwa/.env.*.local
1516

16-
## Playgrounds
17-
timeline.xctimeline
18-
playground.xcworkspace
17+
# Netlify
18+
.netlify/
1919

20-
# Swift Package Manager
21-
#
22-
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
23-
# Packages/
24-
# Package.pins
25-
# Package.resolved
26-
# *.xcodeproj
27-
#
28-
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
29-
# hence it is not needed unless you have added a package configuration file to your project
30-
# .swiftpm
20+
# Vite
21+
pwa/.vite/
3122

32-
.build/
23+
# Test artifacts (tracked per-run as CI artifacts, not committed)
24+
pwa/test-results/
25+
pwa/playwright-report/
26+
pwa/playwright/.cache/
3327

34-
# CocoaPods
35-
#
36-
# We recommend against adding the Pods directory to your .gitignore. However
37-
# you should judge for yourself, the pros and cons are mentioned at:
38-
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
39-
#
40-
# Pods/
41-
#
42-
# Add this line if you want to avoid checking in source code from the Xcode workspace
43-
# *.xcworkspace
28+
# Lighthouse CI
29+
.lighthouseci/
4430

45-
# Carthage
46-
#
47-
# Add this line if you want to avoid checking in source code from Carthage dependencies.
48-
# Carthage/Checkouts
31+
# macOS
32+
.DS_Store
33+
**/.DS_Store
4934

50-
Carthage/Build/
35+
# Editor
36+
.vscode/
37+
*.swp
38+
*.swo
5139

52-
# fastlane
53-
#
54-
# It is recommended to not store the screenshots in the git repo.
55-
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
56-
# For more information about the recommended setup visit:
57-
# https://docs.fastlane.tools/best-practices/source-control/#source-control
40+
# TypeScript
41+
*.tsbuildinfo
5842

59-
fastlane/report.xml
60-
fastlane/Preview.html
61-
fastlane/screenshots/**/*.png
62-
fastlane/test_output
43+
# Logs
44+
*.log
45+
npm-debug.log*
6346

64-
# Python / Proxy
65-
proxy/.venv/
66-
proxy/__pycache__/
67-
proxy/app/__pycache__/
68-
**/__pycache__/
69-
*.pyc
70-
*.pyo
71-
*.egg-info/
72-
dist/
73-
build/
74-
.env
47+
# Coverage
48+
pwa/coverage/

LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

ios/BackWords/App/AppContainer.swift

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)