feature: modernize the app from Angular 9 to Angular 19 - #569
feature: modernize the app from Angular 9 to Angular 19#569neilspalding-hub wants to merge 19 commits into
Conversation
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
…ooling Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
…yer and rxjs 7 cleanup Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
… path Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
…rowserslist Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
…n stack Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Neil Spalding <neil.spalding@cognition.ai>
End-to-end verification passedVerified at runtime by Devin: toolchain in the shell, the production build served as a static PWA, and the full UI flow on the dev server against the live HN API. All 14 assertions passed; no functional defects found. Service worker activated (the headline change)
DevTools shows To prove offline support decisively the static server was killed and a route not yet visited in that tab was loaded — the app shell and jobs feed still rendered, so Poll rendering — proves the two-API data path
Toolchain
The build emits Sass deprecation warnings ( App behaviour against the live HN API
|
Summary
Angular 9 → 19 (one major at a time via
ng update), then the app itself was modernized: standalone bootstrap,HttpClient, RxJS 7, ESLint, real unit tests, and GitHub Actions.Data layer. The hand-rolled
lazyFetch/unfetchservice is gone;HackerNewsAPIServicenow injectsHttpClientand returns typed observables. The oldnode-hnapi.herokuapp.comhost still serves feeds and items but returns 404 for/user/*, so the base URL moved toenvironment.hnApiBaseUrl = https://api.hnpwa.com/v0. That API is a drop-in match for theStory/Usermodels with one gap: apollitem does not carry its options. Poll option ids therefore come from the official HN API (environment.hnOfficialApiBaseUrl) and the options themselves still come from the feed API, which returns them already shaped likePollResult:Architecture.
app.module.ts,CoreModule,SharedComponentsModule,PipesModuleand the item/user feature modules are deleted.main.tsusesbootstrapApplicationwithprovideRouter,provideHttpClientandprovideServiceWorker; item-details and user routes stay lazy vialoadComponent. Templates use built-in control flow (@if/@for), components useinject(), and every route subscription is now a singletakeUntilDestroyed()pipeline instead of leakedtypeSub/pageSubfields —FeedComponentcombines routedataandparamsso a feed type change and a page change can no longer race:SettingsServicealso unsubscribed nothing before: it passed a fresh.bind(this)toremoveEventListener, so theprefers-color-schemelistener was never removed. It now holds one bound handler.Tooling. TSLint/Codelyzer/Protractor and
e2e/are gone, replaced byangular-eslint(eslint.config.js); lint passes clean, which required real fixes — keyboard handlers on click-only elements and theitemselector renamed toapp-item. Karma runsChromeHeadlessNoSandboxby default and there are now 7 specs (HackerNewsAPIServiceURL/poll mapping viaprovideHttpClientTesting,FeedComponentrendering/paging/error states)..travis.yml(Node 6.9) is replaced by.github/workflows/ci.yml: Node 20,npm ci→ lint → test → build, plus a Firebase deploy job onmasterthat accepts eitherFIREBASE_SERVICE_ACCOUNTorFIREBASE_TOKEN.Two config fixes fall out of the Angular 18 application-builder migration:
firebase.jsonnow publishesdist/angular-hnpwa/browser, andng builddefaults to the production configuration so the service worker is actually emitted.Verification
Lint, the 7 unit tests and the production build (with
ngsw.json+ngsw-worker.js) all pass locally, and the dev server renders live HN data — feeds, item comments, polls with vote bars, and user profiles.Notes
package-lock.jsonis now tracked (needed bynpm ci) and the staleyarn.lockwas removed.e2escript was dropped.Link to Devin session: https://app.devin.ai/sessions/8c61275406d040b58467ffa58183ab15
Requested by: @neilspalding-hub
Devin Review