Skip to content
Merged
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
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
pull_request:
branches:
- main

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build TypeScript
run: npm run build

- name: Run unit tests
run: npm test

- name: Install Playwright browsers
run: npx playwright install --with-deps chromium

- name: Run E2E tests
run: npm run test:e2e

- name: Upload Playwright report on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 7
71 changes: 71 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Deploy to GitHub Pages

on:
workflow_run:
workflows:
- "Update Service Worker Cache Version"
types:
- completed
branches:
- main

# Required for GitHub Pages deployment
permissions:
contents: read
pages: write
id-token: write

# Only one Pages deployment at a time; do not cancel in-progress so we don't
# leave the site in a half-deployed state.
concurrency:
group: pages
cancel-in-progress: false

jobs:
deploy:
# Only deploy when the upstream workflow succeeded
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Use main explicitly so we pick up the bot-committed service worker
# cache version update that the upstream workflow may have just pushed.
ref: main

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build TypeScript
run: npm run build

- name: Stage PWA files for deployment
run: |
mkdir -p dist
cp index.html manifest.json service-worker.js dist/
cp icon-192.png icon-512.png dist/
cp -r css dist/
cp -r js dist/

- name: Configure GitHub Pages
uses: actions/configure-pages@v5

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist/

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Dependencies
node_modules/

# TypeScript build output
js/*.js
js/*.js.map
js/*.d.ts

# Playwright
test-results/
playwright-report/

# Misc
.DS_Store
59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,64 @@ The app features a gamification system with points, levels, and daily streaks to
- The app will appear in your applications menu
- You can also launch it from the browser's apps page: `chrome://apps`

## 🚀 Getting Started
## �️ Development (TypeScript)

This project is written in **TypeScript**. The source files live in `src/` and are compiled to `js/` for the browser.

### Project Structure

```
src/ # TypeScript source files
storage.ts # Data layer – StorageManager class & interfaces
app.ts # UI layer – TaskManager class
js/ # Compiled JavaScript (generated – do not edit)
tests/ # Vitest unit tests
e2e/ # Playwright end-to-end tests
```

### Prerequisites

- [Node.js](https://nodejs.org/) (v18 or later recommended)

### Setup

```bash
npm install # Install dependencies
npx playwright install # Install Playwright browsers (first time only)
```

### Build

```bash
npm run build # Compile TypeScript → js/
npm run build:watch # Compile in watch mode (auto-rebuild on save)
```

### Run Locally

```bash
npm run serve # Start a local dev server at http://localhost:3000
```

### Testing

```bash
npm test # Run unit tests (Vitest)
npm run test:watch # Run unit tests in watch mode
npm run test:e2e # Run end-to-end tests (Playwright)
npm run test:e2e:ui # Run E2E tests with the Playwright UI
```

### Workflow

1. Edit TypeScript files in `src/`.
2. Run `npm run build` (or `build:watch`) to compile.
3. Open the app via `npm run serve` or the `index.html` file.
4. Run `npm test` to verify unit tests and `npm run test:e2e` for browser tests.

> **Note:** Never edit files in `js/` directly — they are overwritten on every build.

## �🚀 Getting Started

1. **First Launch**
- The app will load with empty data
Expand Down
Loading