diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6db6c22..2662ca3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,9 @@ jobs: quality: name: Lint, Typecheck & Test runs-on: ubuntu-latest + # A builder that finishes its work and never exits would otherwise hold + # the runner for GitHub's six-hour default. + timeout-minutes: 15 steps: - uses: actions/checkout@v4 @@ -25,16 +28,25 @@ jobs: - name: Lint run: npm run lint + # The root tsconfig has "files": [] and only references, so a bare + # `tsc --noEmit` checks no files at all. Point it at the real configs. - name: Typecheck - run: npx tsc --noEmit + run: | + npx tsc --noEmit -p tsconfig.app.json + npx tsc --noEmit -p tsconfig.spec.json - name: Run unit tests (includes axe accessibility scans) run: npm test + # The only step that prerenders every route and enforces the bundle budget. + - name: Production build + run: npm run build + e2e-accessibility: name: E2E & Accessibility runs-on: ubuntu-latest needs: quality + timeout-minutes: 20 steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index f65295e..1584dcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,118 @@ All notable changes to this project will be documented in this file. +## 2026-11-21 - version 1.4.12 + +- **Interview practice deck.** The last lesson ends with a flashcard deck of all 78 interview questions in the guide: one question at a time, the answer hidden until asked for, "Got it" to take a card out and "Ask again" to send it to the back, filterable by topic. The questions were scattered across twelve pages, a few at the bottom of each, which is no way to revise +- **Every lesson's questions live in one bank** (`interview-bank.ts`), keyed by lesson. Each lesson reads its own entry, and the deck reads all of them without importing twelve lesson components. A spec checks every lesson has at least five, none repeats, and each page renders its own. The cost: about 12 kB gzipped of question text now loads with the first lesson you open, instead of 1–3 kB per page +- **Angular guide, lesson 13: interview prep** (`/thoughts/angular-13-interview`). NgModule-era Angular side by side with the same component written today, the migration schematics, NgRx Store and SignalStore, and how to turn the bugs from this guide into interview answers +- **fix: the no-NgModules fitness test matched code samples.** Lesson 13 prints an `@NgModule` as an example, and the regex flagged it. It now reads real decorators with the TypeScript parser, the same fix the OnPush check got in 1.4.8 + +## 2026-11-21 - version 1.4.11 + +- **fix: prerendered pages showed the time the site was built.** The menu bar clock rendered on the server, so every Thoughts page shipped a frozen build-time clock until the JavaScript loaded. The clock now renders empty on the server and starts in `afterNextRender`, which only runs in the browser +- **The menu bar hydrates.** It was marked `ngSkipHydration` to hide that server/browser difference, so the browser threw away the server's HTML for the whole bar and drew it again. With the difference gone, the attribute is gone. The interval also no longer starts from inside an `effect` with no signal dependencies +- **A spec renders the menu bar on the real server platform** (`menu-bar.server.spec.ts`, through `renderApplication`). TestBed runs browser-only hooks, so it can't show what the server sends +- **Angular guide, lesson 12: SSR and hydration** (`/thoughts/angular-12-ssr`). The live demo says whether the page you're reading was prerendered or rendered in your browser: the server writes its render time into `TransferState` and the browser reads it back. The lesson covers render modes per route, hydration, browser-only code, the HTTP transfer cache, event replay, incremental hydration and `PendingTasks` +- I formatted the demo's time with `DatePipe` first, and the initial bundle went to 407.07 kB, over the 400 kB budget. It's the lesson 03 trap again; `Intl.DateTimeFormat` brought it back to 395.26 kB + +## 2026-11-21 - version 1.4.10 + +- **fix: CI's typecheck checked zero files.** It ran `npx tsc --noEmit` against the root `tsconfig.json`, which has `"files": []` and only project references, so plain `tsc` compiled nothing and passed. It now typechecks `tsconfig.app.json` and `tsconfig.spec.json` +- **CI runs the production build.** It's the only step that prerenders every route and enforces the bundle budget, and CI never ran it +- **Every CI job has a time limit.** I've seen `ng build` and `ng test` finish their work and then never exit; without `timeout-minutes` that holds a runner for GitHub's six-hour default +- **A spec reads the CI workflow** (`ci-workflow.spec.ts`), so none of the three gaps can come back quietly +- **An e2e test for the lesson nav** (`e2e/lesson-nav.spec.ts`). The unit specs drive a fake `IntersectionObserver`; this one scrolls a real page in Chromium +- **Corrected: the contact form's reset comment.** In 1.4.8 I wrote that `form.reset()` only re-rendered the OnPush contact form because a signal write sat next to it. A new spec shows it renders on its own: reactive form controls keep touched and status in signals, and `NgControlStatus` reads them in its host bindings +- **Angular guide, lesson 11: testing** (`/thoughts/angular-11-testing`). The live demo runs the real `notBlank` validator's tests in the page, with a switch that puts back the bug lesson 08 fixed. The lesson covers component specs, `HttpTestingController` with fake timers, `RouterTestingHarness`, marble tests, fitness tests and when e2e earns its place + +## 2026-11-21 - version 1.4.9 + +- **Every lesson has an "On this page" nav.** It sticks to the top while you read, jumps to a section (moving focus to its heading), and highlights the section in view with `aria-current="location"`. Smooth scrolling switches off under `prefers-reduced-motion`. The lessons had grown long enough that I kept losing my place in them +- **Two directives build it.** `LessonSection` matches every `h2` in a lesson, gives it an id from its text and registers it with `ScrollSpy`, which watches the registered headings with an `IntersectionObserver` created only in the browser. The lesson component takes `ScrollSpy` as a host directive, so no lesson has to remember an attribute. The nav and the heading ids are both in the prerendered HTML +- **Angular guide, lesson 10: directives** (`/thoughts/angular-10-directives`). The live demos are a structural directive built on `TemplateRef` and `ViewContainerRef`, and an attribute directive composed into a component with `hostDirectives` and a renamed input. The lesson walks through the nav's own code +- **Initial bundle 392.64 → 394.56 kB.** All the new code is lazy, but this is the first use of `contentChildren`, `hostDirectives` and `afterNextRender`, and their runtime lives in the shared `@angular/core` chunk + +## 2026-11-21 - version 1.4.8 + +- **Every component is OnPush.** None of the 35 components set a change detection strategy, so every one was checked on every pass. Each now uses `ChangeDetectionStrategy.OnPush`. Before switching, I audited each component for state that changes outside signals and template events, the kind OnPush stops rendering, and found none. The contact form's reset after sending is the closest call, and it now carries a comment saying why it still renders +- **A test keeps it that way.** `architecture.spec.ts` reads every `@Component` decorator with the TypeScript parser and fails, naming the class, on any component that doesn't choose OnPush or an explicit `Eager`. Using the parser rather than a text search means the code samples printed in the lessons don't count as components +- **Angular guide, lesson 09: change detection** (`/thoughts/angular-09-change-detection`). The live demo passes one object to an `Eager` child and an `OnPush` child: mutating it updates only the Eager one, replacing it updates both, and a signal reaches the OnPush child with no input change at all. The lesson covers zoneless scheduling, `markForCheck` vs `detectChanges`, NG0100, and the 21.2 rename of `Default` to `Eager` + +## 2026-11-21 - version 1.4.7 + +- **fix: the contact form accepted blank messages.** `Validators.required` only rejects an empty string, so a name or message of nothing but spaces got through. Both now use a small `notBlank` validator in `shared/validators.ts` +- **Send explains instead of greying out.** The button used to stay disabled until the form was valid, which can't be focused and says nothing about what's wrong. It's now enabled, except while a message is sending, so it can't double-submit. Pressing it on an invalid form shows every error and moves focus to the first field that needs fixing +- **Errors are tied to their fields.** Each error message has an id, and its input gets `aria-invalid` and `aria-describedby` while the error shows. The sending, sent and failed messages now live in one `role="status"` region that's always in the DOM, so they're announced. Name and email have `autocomplete` hints +- **Angular guide, lesson 08: forms** (`/thoughts/angular-08-forms`). The live demo is a password pair checked by a group-level validator, plus a `FormArray` of links you can add and remove, with the form's status and raw value shown as you type. The lesson covers async validators, `ControlValueAccessor`, and Angular 21's experimental Signal Forms, checked against the installed `@angular/forms` 21.2 +- Initial bundle 391.72 kB → 392.09 kB, the lesson's metadata. Forms code stays in lazy chunks + +## 2026-11-21 - version 1.4.6 + +- **Every tag has its own page**: `/thoughts/tag/`, prerendered with its own title and canonical URL, and every tag pill in the list and the reader links to it. `/thoughts/tag/angular-guide` is now the reading list for this series. It's a path param rather than `?tag=` on purpose: prerendering writes one file per path, so a query-param page would be served the unfiltered list and then change under the reader during hydration. Prerendered routes went from 27 to 74 +- **Cards are links now.** The Thoughts list cards were `div role="button"`s calling `router.navigate()`, so they had no `href` for crawlers, no middle-click, and nowhere to put the tag links (a link can't sit inside a button). The title is a real `routerLink`, and a stretched `::after` keeps the whole card clickable +- **fix: a mistyped URL failed the first navigation** with `NG04002: Cannot match any routes`. There's now a `**` route, last in the table, that redirects to the desktop +- The reader takes `:slug` as an input through `withComponentInputBinding()` instead of `toSignal(route.paramMap)`, which drops its `ActivatedRoute` and RxJS imports. A new spec runs the real route table with the real `appConfig`, so a missing route, a wildcard in the wrong place, or a router feature that's switched off fails a test +- **Angular guide, lesson 07: routing** (`/thoughts/angular-07-routing`). The playground parses a URL with Angular's own `UrlSerializer` and matches it against this site's actual route table. A checkbox moves the wildcard to the front, to show first-match-wins. Lesson 04's text now notes that lesson 07 replaced the code it shows +- Initial bundle 389.82 kB → 391.72 kB for the input-binding router feature, the two new routes and the lesson metadata. I didn't split that 1.9 kB any further + +## 2026-11-21 - version 1.4.5 + +- **GET requests retry transient failures.** One network blip used to put the Projects app straight into "Failed to load projects". A functional interceptor, `retryTransientErrors`, now retries any GET that fails with a network error (status 0) or a 5xx, twice, 400ms and then 800ms later. A 404 fails straight away, and nothing but GETs is ever retried, because a retried POST is a second submission +- **Angular guide, lesson 06: RxJS and HTTP** (`/thoughts/angular-06-rxjs`). The live demo runs two search boxes over a deliberately slow fake server, where one-letter queries answer slowest. Type "sig" and mergeMap ends on the stale "s" results while switchMap shows "sig". The operator behind it has marble tests on `TestScheduler` +- Initial bundle 384.98 kB → 389.82 kB. I measured the parts: without the interceptor it's 389.00 kB, and without lesson 06 registered it's 388.39 kB. RxJS's timer and async-scheduler code is shared by the interceptor's backoff and the lesson's `delay`, so it lands in an eager chunk either way. I tried writing the demo with `timer` instead of `delay`, and it saved 0.26 kB, not enough to beat the more readable version. That leaves 10 kB of headroom, so the remaining lessons have to stay out of eager code + +## 2026-11-21 - version 1.4.4 + +- **Saved reading progress for the Angular guide**: every lesson ends with a "Mark lesson complete" toggle (a real `aria-pressed` button whose label changes too, so the state isn't colour alone). The series nav counts "N of M complete", and the Thoughts list badges completed lessons. Progress is kept in localStorage +- **Browser storage is an injection token now.** `BROWSER_STORAGE` is localStorage in the browser and `null` during prerendering, decided once in its factory. `SettingsService` used to check `isPlatformBrowser` and reach for the global itself, in two places. Reading progress would have been the third copy, so both now inject the token, and specs hand in an in-memory `Storage` instead of clearing the real one +- Saved progress that isn't a list of slugs throws with the bad value in the message, instead of quietly resetting someone's progress to nothing +- **Angular guide, lesson 05: dependency injection** (`/thoughts/angular-05-dependency-injection`). A live demo puts buttons under one shared provider and under one provider each, so the injector tree is something to click rather than a diagram. The demo's instance numbers come from a provider on the page, not a module-level counter. A counter would keep counting across requests on a long-running server, which is the exact SSR leak the lesson warns about +- Initial bundle 384.14 kB → 384.98 kB for the progress service and toggle. The lesson itself is a 14 kB lazy chunk + +## 2026-11-21 - version 1.4.3 + +- **Series navigation in the reader**: every Angular guide lesson ends with "Part N of M" and links to the previous and next lessons. They're real `routerLink` anchors, so they prerender as `href`s and ⌘-click opens a new tab +- **fix: the reader went stale on reuse.** `thought-detail.ts` read `route.snapshot` once, and the router reuses the component when only `:slug` changes, so Next would have kept showing the lesson you were on. The slug is now a signal (`toSignal(route.paramMap)`), and the thought, series position and lazy lesson page are all `computed()`/`resource()` off it. The reader also scrolls back to the top when the slug changes +- The reader specs now drive the real router through `RouterTestingHarness` instead of mocking `ActivatedRoute.snapshot`. A snapshot mock can't express a reused component getting a new param, which is how the bug hid +- **Dock state is read-only from outside.** `DockService` keeps private writable signals and exposes `asReadonly()` views. `app.ts` and `menu-bar.service.ts` each had their own copy of "minimize this app" writing the Map directly; both now call `minimizeApp()` +- **Angular guide, lesson 04: signals** (`/thoughts/angular-04-signals`). Demos show three synchronous writes producing one effect run, and a `linkedSignal` shipping choice that resets when the country changes but stays writable +- The lesson kicker says "Part 04" instead of "04 of 13", so the page doesn't show two different totals now that the series nav counts what's actually published +- Initial bundle 377.25 kB → 384.14 kB. I measured it rather than guessed: a build without `RouterLink` is 377.83 kB, so the router's link directive is the 6.3 kB. I'm keeping it, because real prerendered links and correct modifier-click handling are worth it and later lessons reuse it, but there's now 16 kB of headroom under the 400 kB budget + +## 2026-11-21 - version 1.4.2 + +- **fix: ⌃⌥Space never opened Spotlight.** `App.onKeydown` called `shortcuts.handleKeydown(event)` twice per keydown, so every toggle shortcut flipped and flipped straight back, and ⌃⌥Tab cycled two windows at a time. It's now bound once through `host: { '(document:keydown)': … }` instead of `@HostListener` +- **fix: ⌘Space was still swallowed.** The same handler kept a `preventDefault()` on ⌘Space that the 1.3.4 remap meant to remove, so the real macOS Spotlight shortcut did nothing while the site had focus. Specs now pin both: one ⌃⌥Space opens Spotlight, and ⌘Space is left un-prevented +- **Readable thought dates**: cards and the reader show "Jun 15, 2026" instead of `2026-06-15`, inside a `