feature: React + TypeScript + Vite foundation (wave 1 of Angular rewrite) - #688
feature: React + TypeScript + Vite foundation (wave 1 of Angular rewrite)#688devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Co-Authored-By: Paul Abboud <abboudpaul112@gmail.com>
Co-Authored-By: Paul Abboud <abboudpaul112@gmail.com>
🤖 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:
|
Smoke test: React + TS + Vite foundationTested locally on Routing + app shell (dev server)
SettingsContext theme persistence & system color scheme
Production build: PWA + deep links
Notes / non-blocking
Session: https://app.devin.ai/sessions/3fd46ac1891c4708a8268feee29628b5 |





Summary
Wave 1 of the Angular 9 → React rewrite: everything shared, nothing feature-level. Later PRs branch off this one and each own a single component file + its SCSS, so this PR deliberately defines all root/shared files up front and leaves the feature components as stubs.
What lands here:
package.jsondrops all@angular/*,rxjs,zone.js,unfetch, karma/protractor/jasmine/tslint/codelyzer; addsreact18,react-router-dom6,vite,@vitejs/plugin-react,vite-plugin-pwa,sass,typescript5. Scripts aredev/build(tsc && vite build)/preview. Deletedangular.json,tsconfig.app.json,tsconfig.spec.json,tslint.json,karma.conf.js,ngsw-config.json,src/test.ts,browserslist,e2e/,yarn.lock(npm +package-lock.jsonnow).index.htmlports the PWA/social metadata,#skiplink and.app-loadershell fromsrc/index.html;<app-root>→<div id="root">; GA snippet and<base href>dropped. Static files movedsrc/assets|favicon.ico|manifest.json→public/, referenced as absolute/assets/....vite-plugin-pwa(registerType: 'autoUpdate') reproduces thengsw-config.jsonApp Shell — precachejs/css/html/ico, runtimeCacheFirstfor/assets/*and image/font extensions — and generates the webmanifest from the oldmanifest.jsonvalues. The static manifest<link>was removed so the build has exactly one manifest.src/app/**,src/main.ts,polyfills.ts,environments/) and excluded intsconfig.jsonso they don't type-check; wave 3 deletes them.Ported shared layer:
src/models/—story,comment,user,poll-result,settings,feed-type.typeas interfaces, field names preserved verbatim (including thecrated_timetypo).Story.time_agois typedstring(the Angular model saidnumberbut templates render it as text). Newfeed-name.type.ts('news' | 'newest' | 'show' | 'ask' | 'jobs') is theFeedprop contract wave-2 sessions code against.src/api/hackerNewsApi.ts—HackerNewsAPIServiceas async fetch functions (fetchFeed,fetchItemContent,fetchPollContent,fetchUser), throwing on non-2xx. Poll logic preserved but parallelized:src/context/SettingsContext.tsx—SettingsServiceasSettingsProvider+useSettings(), same localStorage keys/defaults (theme: 'default',titleFontSize: '16',listSpacing: '0') and the sameprefers-color-scheme: darklistener, including the "no saved theme → adopt system scheme on mount" behavior.src/utils/comment.ts— thecommentpipe ascommentCount(n)(identicaldiscuss/singular/plural output).src/components/Loader.tsx,ErrorMessage.tsx(+ their SCSS) ported from the shared Angular components.Routing (
src/App.tsx) reproducesapp.component.html(themed wrapper →body-cover→wrapper→ Header / routes / Footer) and the full v6 table fromapp.routes.ts:/→/news/1,/{news,newest,show,ask,jobs}/:page→<Feed feedType=…/>,/item/:id,/user/:id; bare feed paths also redirect to page 1.Header,Footer,Settings,Feed,Item,ItemDetails,Comment,Userexist as stubs with their real prop shapes only.Verified:
npx tsc --noEmit,npm run build(emitssw.js+ one manifest intodist/),npm run devserves the stub app.Note: this targets
COG-GTM/angular2-hn— the original request namedankehao-demo/angular2-hn, which Devin has no write access to; both repos are at the same commit.Devin-Org: engineering
Link to Devin session: https://app.devin.ai/sessions/3fd46ac1891c4708a8268feee29628b5
Requested by: @abboudp
Note
Devin errored when opening this Pull Request as abboudp.
As a fallback, Devin opened this PR as itself.
Devin Review