|
| 1 | +# Plan: migration to Node 24, TypeScript, Playwright, modern lint |
| 2 | + |
| 3 | +## Goals |
| 4 | + |
| 5 | +- Upgrade runtime and infrastructure to Node.js 24 LTS. |
| 6 | +- Move application code to TypeScript without changing external behavior. |
| 7 | +- Add end-to-end tests with Playwright. |
| 8 | +- Update linting to a modern, maintained ESLint setup. |
| 9 | +- Keep backward compatibility for routes, startup flow, and environment variables. |
| 10 | +- Standardize dependency update workflow with `npm-check-updates`. |
| 11 | + |
| 12 | +## Scope and compatibility constraints |
| 13 | + |
| 14 | +- Keep route contract unchanged: `/` and `/error` must behave identically. |
| 15 | +- Keep env contract unchanged: `SERVER_MESSAGE`, `ROLLBAR_TOKEN`. |
| 16 | +- Keep startup compatibility: `npm start`, `make start`, Docker run flow from README. |
| 17 | +- Keep rendered content and core page assertions stable (existing tests + e2e). |
| 18 | + |
| 19 | +## Step-by-step plan |
| 20 | + |
| 21 | +### 1) Baseline and regression guardrails |
| 22 | + |
| 23 | +- Freeze current behavior with existing unit tests (`jest`) and compatibility checklist. |
| 24 | +- Add a compact compatibility matrix (routes, env, startup, docker smoke). |
| 25 | +- Ensure current `test` and `lint` pass before migrations. |
| 26 | + |
| 27 | +### 2) Node 24 LTS migration |
| 28 | + |
| 29 | +- Update `package.json` engines to `24.x`. |
| 30 | +- Add `.nvmrc` with `24`. |
| 31 | +- Update `Dockerfile` base image to `node:24-slim`. |
| 32 | +- Validate local + container execution (`make start`, `make compose-test-ci`, `make compose-lint-ci`). |
| 33 | + |
| 34 | +### 3) TypeScript migration (incremental, non-breaking) |
| 35 | + |
| 36 | +- Add `typescript`, `@types/node`, and `tsconfig.json` (ESM / NodeNext setup). |
| 37 | +- Add scripts: `build`, `typecheck`. |
| 38 | +- Migrate server files to TS first: `server/plugin.*`, `server/routes.*`. |
| 39 | +- Preserve runtime behavior and public API/HTTP responses. |
| 40 | + |
| 41 | +### 4) Linter modernization |
| 42 | + |
| 43 | +- Move from legacy `.eslintrc.yml` to ESLint flat config (`eslint.config.js`). |
| 44 | +- Update ESLint stack to current supported versions. |
| 45 | +- Add TS-aware linting (`typescript-eslint`) + keep Jest/Node rules. |
| 46 | +- Port critical existing rules to avoid noisy non-functional churn. |
| 47 | + |
| 48 | +### 5) Add Playwright e2e |
| 49 | + |
| 50 | +- Add `@playwright/test`, `playwright.config.ts`, `e2e/` tests. |
| 51 | +- Cover critical flows: |
| 52 | + - main page without `SERVER_MESSAGE` |
| 53 | + - main page with `SERVER_MESSAGE` |
| 54 | + - `/error` page behavior |
| 55 | +- Add `test:e2e` script. |
| 56 | +- Add CI job for e2e with report artifact. |
| 57 | + |
| 58 | +### 6) Add and formalize npm-check-updates usage |
| 59 | + |
| 60 | +- Ensure `npm-check-updates` is present in dev dependencies (update to current). |
| 61 | +- Add scripts in `package.json`: |
| 62 | + - `deps:check` (show outdated deps) |
| 63 | + - `deps:update` (update package.json ranges) |
| 64 | + - `deps:update:interactive` (optional targeted workflow) |
| 65 | +- Add `.ncurc.json` policy: |
| 66 | + - default strategy for safe regular updates |
| 67 | + - optional reject list for risky majors (apply selectively) |
| 68 | +- Document dependency update workflow in README. |
| 69 | + |
| 70 | +### 7) Dependency upgrade wave and stabilization |
| 71 | + |
| 72 | +- Upgrade dependencies in controlled batches (tooling and runtime separately). |
| 73 | +- Treat Fastify ecosystem updates as high-risk and verify with full regression. |
| 74 | +- After each batch run: `lint`, `typecheck`, unit tests, e2e tests, docker smoke. |
| 75 | +- Update docs/CI configs to reflect final commands and toolchain. |
| 76 | + |
| 77 | +## Recommended PR slicing |
| 78 | + |
| 79 | +1. Node 24 + Docker/CI alignment. |
| 80 | +2. TypeScript scaffold + `typecheck`. |
| 81 | +3. Server TS migration. |
| 82 | +4. ESLint modern config. |
| 83 | +5. Playwright e2e + CI integration. |
| 84 | +6. `npm-check-updates` scripts + `.ncurc.json` + docs. |
| 85 | +7. Dependency major/minor upgrade batches + final regression. |
| 86 | + |
| 87 | +## Definition of Done |
| 88 | + |
| 89 | +- Node 24 is used in local dev, Docker, and CI. |
| 90 | +- `lint`, `typecheck`, unit and e2e test suites are green. |
| 91 | +- Route/env/startup contracts are unchanged and verified. |
| 92 | +- Dependency maintenance workflow with `npm-check-updates` is documented and usable. |
0 commit comments