Repository navigation
feature: PWA (vite-plugin-pwa), Firebase Hosting and GitHub Actions CI for the React app - #883
Merged
devin-ai-integration[bot] merged 10 commits intoOct 8, 2026
Conversation
…I for the React app Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
…undation' into devin/1791470086-react-pwa-build-deploy
Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
…undation' into devin/1791470086-react-pwa-build-deploy
Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
…ook control Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
…undation' into devin/1791470086-react-pwa-build-deploy
…rs from cache Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Comment on lines
+31
to
+36
| - run: npm ci | ||
| - run: npm run lint | ||
| - run: npm run typecheck | ||
| - run: npm test | ||
| - run: npm run build | ||
| - run: npm run format:check |
Author
There was a problem hiding this comment.
Author
There was a problem hiding this comment.
This is intentional for this workstream: the brief asks to replace .travis.yml with CI for react-app/. Firebase Hosting now serves react-app/dist, so the Angular build is no longer what ships. The old Travis job only ran npm run build on Node 6.9, which no longer runs Angular 9 without --openssl-legacy-provider. Whether to keep an Angular build check until src/ is deleted is the integrator's decision, so I'm leaving this thread open.
… first-visit cache warm-up Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
devin-ai-integration
Bot
merged commit Oct 8, 2026
ebc47f9
into
devin/1791469878-react-phase0-foundation
4 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Workstream E: ports offline support, the Web App Manifest, Firebase Hosting and CI from the Angular app to the Vite app in
react-app/.Service worker / manifest (
vite.config.ts,vite-plugin-pwa,generateSW+registerType: 'autoUpdate')src/manifest.jsonvalues: name/short_nameAngular 2 HN, 144/192/256/512 icons, theme#b92b27, background#ffffff,standalone,portrait,start_url: ./?utm_source=web_app_manifest. The plugin injects<link rel="manifest">.globPatterns: ['**/*.{js,css,html,ico,png,svg}']withincludeManifestIcons: falseand noincludeAssets. This avoids the duplicate-URLadd-to-cache-list-conflicting-entriestrap.navigateFallback: 'index.html'makes deep links like/item/123work offline.NetworkFirstfornode-hnapi.herokuapp.com(hn-api, 200 entries) andapi.hnpwa.com(hnpwa-api, 100 entries), with a 5 s network timeout and 7-day expiry. The origins live insrc/pwa/runtime-cache.ts, which both the config and the register module use.skipWaiting+clientsClaim, so the first visit is controlled straight away.Registration (
src/pwa/registerSW.ts, imported once frommain.tsxviasrc/pwa/index.ts)registration.update()every hour while online. It skips the poll while offline or while a worker is installing.controllerchange,registerSWre-requests every runtime-cached URL that started before control, read fromperformanceresource entries. APerformanceObservercatches requests still in flight at that moment.Retiring the Angular service worker (
public/ngsw-worker.js): returning visitors still have@angular/service-workerregistered at/ngsw-worker.js, and it would keep serving the cached Angular index. The safety worker served at that URL replaces it on the browser's next update check. It deletes thengsw:*caches, unregisters itself and reloads open tabs, which then registersw.js. It is excluded from the precache (globIgnores) and servedno-cache. I checked the upgrade against the real Angular production build: the same origin switched fromdist/angular-hnpwatoreact-app/dist, and on the first reload the page was controlled bysw.jswith nongsw:*caches and the React app rendered.Firebase (
firebase.json): hostingpublic: react-app/dist,predeploy=npm --prefix react-app ci && run build, SPA rewrite** → /index.html, andCache-Control: no-cacheforsw.js,ngsw-worker.js,index.html,manifest.webmanifestand extensionless routes (including/). Hashed/assets/*-[hash].(js|css)getpublic, max-age=31536000, immutable. Thedatabaserules entry is unchanged and.firebasercis untouched. I checked the headers with the Hosting emulator.CI (
.travis.yml→.github/workflows/react-app.yml): runs on PRs and on pushes tomaster. Jobs run on Node 20 withnpm ciand the npm cache, inreact-app/:check: lint, typecheck, test, build, format:checke2e: Playwright against the production builddeploy: push tomasteronly, after both jobs pass. It usesFirebaseExtended/action-hosting-deploywithFIREBASE_SERVICE_ACCOUNT, falls back tofirebase-toolswithFIREBASE_TOKEN, and skips with a notice when neither secret is set. Forks and PRs never fail on missing credentials.E2E (
playwright.config.ts,e2e/offline.spec.ts)vite build && vite preview.PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS=1is set at the top of the config. Locally it uses the system Chrome when Playwright browsers aren't installed./news/1online, waits for SW control, and checks that the feed reaches the runtime cache. Then it opens the item page client-side and goes offline: it removes all routes, aborts every request and callssetOffline, because route mocks otherwise keep answering. It reloads and expects the feed rendered from cache, then deep-links to/item/8863(served bynavigateFallback) and expects the item rendered from cache. A never-visited item must fail.manifest.webmanifestand every icon URL. A third registers/ngsw-worker.jsover the React SW with a fakengsw:cache, then asserts the cache is gone andsw.jsis back in control after the reload.Generated precache manifest (
dist/sw.js): 28 entries, 28 uniqueLighthouse (mobile preset,
vite previewvs Angularng build --prod,/news/1, 3 runs each)TBT is 13–19 ms for React and 155–200 ms for Angular. FCP/LCP is about 1.5 s for both, and CLS is 0 for both. The Angular README's claimed 87 is out of date. I added
public/robots.txtbecause the SEO audit flagged it.Installability: the manifest is valid (name, icons ≥192/512,
standalone,start_url), the SW is active and controls the page, and Chrome reports no installability errors (checked with a persistent profile).Offline screenshots (live API: first visit online, open one item, go offline, reload, then deep link)
The React shell has no header yet; that comes in another workstream.
/item/:iddeep link, offlineVerification
In
react-app/,npm run lint,typecheck,test(10 files, 100 tests, 12 of them forregisterSW),build,format:checkande2eall pass. The e2e suite (3 tests) also passed--repeat-each=2.Shared-file changes
react-app/src/main.tsx: adds one line,import './pwa';react-app/tsconfig.app.json: addsvite-plugin-pwa/clienttotypesDevin-Org: engineering
Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/d251403d3f8c4929b5ec9516807084d2
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/d251403d3f8c4929b5ec9516807084d2?variant=devin
Requested by: @ishita-cog
Note
Devin errored when opening this Pull Request as ishita-cog.
As a fallback, Devin opened this PR as itself.
Devin Review