64 lines
2.1 KiB
Markdown
64 lines
2.1 KiB
Markdown
---
|
|
phase: "03"
|
|
plan: "01"
|
|
subsystem: js-toolchain
|
|
tags: [typescript, esbuild, vitest, d3]
|
|
dependency_graph:
|
|
requires: []
|
|
provides: [js-build-pipeline, ts-type-checking, js-test-runner]
|
|
affects: [assets/, Resources/public/]
|
|
tech_stack:
|
|
added: [esbuild, typescript, vitest, jsdom, d3-scale, d3-selection, d3-time, d3-time-format, d3-scale-chromatic, d3-array]
|
|
patterns: [iife-bundle, esm-source]
|
|
key_files:
|
|
created:
|
|
- package.json
|
|
- tsconfig.json
|
|
- vitest.config.ts
|
|
- assets/src/heatmap.ts
|
|
- assets/test/heatmap.test.ts
|
|
- Resources/public/heatmap.js
|
|
modified:
|
|
- .gitignore
|
|
decisions:
|
|
- "IIFE format with KimaiHeatmap global name for browser compatibility"
|
|
- "ES2022 target with bundler moduleResolution"
|
|
- "jsdom environment for vitest d3 testing"
|
|
metrics:
|
|
duration: "3min"
|
|
completed: "2026-04-08"
|
|
---
|
|
|
|
# Phase 3 Plan 01: JS Toolchain Setup Summary
|
|
|
|
**One-liner:** esbuild + TypeScript + Vitest pipeline for d3 heatmap development with jsdom test environment.
|
|
|
|
## What Was Done
|
|
|
|
1. **package.json** -- Created with build/test scripts, installed d3 sub-modules as runtime deps and typescript/esbuild/vitest as dev deps
|
|
2. **tsconfig.json** -- Strict TS config targeting ES2022 with bundler module resolution
|
|
3. **vitest.config.ts** -- jsdom environment with globals enabled
|
|
4. **Placeholder source and test** -- `assets/src/heatmap.ts` stub and passing test in `assets/test/heatmap.test.ts`
|
|
5. **.gitignore** -- Added `.phpunit.result.cache`
|
|
|
|
## Verification Results
|
|
|
|
- `npm run build` -- Produces `Resources/public/heatmap.js` (537b minified)
|
|
- `npm test` -- 2 tests pass (570ms)
|
|
- `npx tsc --noEmit` -- No type errors
|
|
|
|
## Deviations from Plan
|
|
|
|
### Auto-fixed Issues
|
|
|
|
**1. [Rule 2 - Missing] Added .phpunit.result.cache to .gitignore**
|
|
- **Found during:** Task 4 verification
|
|
- **Issue:** PHPUnit result cache file was showing as untracked
|
|
- **Fix:** Added to .gitignore
|
|
- **Files modified:** .gitignore
|
|
|
|
## Commits
|
|
|
|
| Task | Commit | Description |
|
|
|------|--------|-------------|
|
|
| 1-4 | 032b6f8 | feat: add JS toolchain -- esbuild, TypeScript, Vitest |
|