Skip to content

Latest commit

 

History

History
48 lines (37 loc) · 2.46 KB

File metadata and controls

48 lines (37 loc) · 2.46 KB

Repository Guidelines

Project Structure & Module Organization

This is a static UK ILR absence tracker. Keep the page shell, styles, and script order in index.html. Put browser UI and interaction code in src/app.ts; keep the sliding-window absence calculations in the pure functions in src/model.ts. Node tests live in test/model.test.js and exercise the compiled dist/model.js. trips.json.example is safe sample data; trips.json is local personal data and is intentionally ignored. scripts/build-data.js converts it to the ignored browser input in dist/. The GitHub Pages workflow is in .github/workflows/pages.yml.

Build, Test, and Development Commands

  • make build — compile TypeScript and generate dist/trips-data.js from JSON.
  • make check — type-check without producing files; run this before committing.
  • make test — build, then run the Node test suite with CI coverage reporting.
  • make watch — generate trip data once, then continuously recompile TypeScript.
  • make clean — remove generated dist/ output.

Use Node 20 or later. If tsc is not installed locally, mirror CI with npx --yes -p typescript@5 tsc -p ..

Coding Style & Naming Conventions

Use TypeScript with two-space indentation, semicolons, double-quoted strings, and the strict compiler options in tsconfig.json. Prefer small, typed helper functions and descriptive camelCase names such as tripBounds and firstArrivalOn. Keep model code deterministic and DOM-free; app.ts owns DOM access and rendering. The two source files compile as plain scripts sharing global scope, so do not add module import or export statements without revising the build design.

Testing Guidelines

Add focused node:test cases in test/model.test.js for every model change. Name tests as observable behaviour, for example "same-day trip costs no days". Cover calendar boundaries, inclusive-day rules, and regression cases; use the existing deterministic fuzz/reference pattern when changing window logic. Run make test before opening a pull request.

Commit & Pull Request Guidelines

Use concise Conventional Commit-style subjects, as in feat: persist edits in localStorage, refactor: drop the today override, and docs: Add README and LICENSE. Keep each commit scoped. PRs should explain the user-visible or calculation impact, list tests run, link any relevant issue, and include a screenshot for visual changes. Never commit a real trips.json file or personal travel data.