Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/react-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# CI for the React migration under react/. Mirrors .travis.yml (install -> build on master),
# adding lint, unit tests with coverage gates and Playwright e2e. Firebase deploy stays on Travis
# until the final migration phase switches hosting to the React build.
# CI for the React app under react/: format, lint, unit tests with coverage gates, build and Playwright e2e.
# Firebase deploy of react/dist stays on Travis (.travis.yml).
name: React CI

on:
Expand Down
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
language: node_js
node_js:
- "6.9"
- "20"

branches:
only:
- master

before_script:
- npm install -g firebase-tools
- npm install -g @angular/cli
- cd react && npm ci && cd ..

script:
- npm run build
- cd react && npm run build && cd ..

after_success:
- firebase use default
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Contributing

Thank you for your interest in contributing! Please feel free to put up a PR for any issue or feature request.
Even if you have little to no experience with Angular, I'll be more than happy to help. :)
Even if you have little to no experience with React, I'll be more than happy to help. :)

## Setup

1. Fork the repo
2. Clone your fork
3. Make a branch for your feature or bug fix
4. If you don't have Angular CLI installed: `npm install -g angular-cli@latest`
5. `ng init`
6. Type `n` for each file to not overwrite any file changes
7. Run `npm start` and open `localhost:4200` in a browser
4. `cd react && npm install`
5. `npx playwright install chromium` (for e2e tests)
6. Run `npm run dev` and open `localhost:5173` in a browser
7. Before opening a PR: `npm run format:check && npm run lint && npm run typecheck && npm test && npm run e2e`
8. Work your magic
9. Run `npm run build` or `npm run static-serve` to kick off a production build and make sure nothing is broken
10. To test service worker changes:
Expand Down
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</p>

<p align="center">
A progressive Hacker News client built with Angular
A progressive Hacker News client built with React and TypeScript (originally Angular)
</p>

<p align="center">
Expand Down Expand Up @@ -43,11 +43,11 @@

## Offline Support

This app uses [Workbox](https://workboxjs.org/) to generate a service worker as part of the build step to load quickly and work offline.
This app uses [vite-plugin-pwa](https://vite-pwa-org.netlify.app/) ([Workbox](https://developer.chrome.com/docs/workbox)) to generate a service worker as part of the build step: the app shell is precached and static assets are cached on first use, so the app loads quickly and works offline.

## Manifest

With Chromium based browsers for Android (Chrome, Opera, etc...), Angular 2 HN includes a Web App Manifest that allows you to install to your homescreen.
With Chromium based browsers for Android (Chrome, Opera, etc...), the app includes a Web App Manifest that allows you to install to your homescreen.

<p align="center">
<img src = "http://i.imgur.com/1RaaNkr.png">
Expand All @@ -73,16 +73,15 @@ Feel free to send me feedback on [twitter](https://twitter.com/hdjirdeh) or [fil

## Build process

Note: This project has been ejected (with AOT + production settings) in order to customize Webpack configurations.
The app lives in [`react/`](react/) (React 18, TypeScript, Vite, React Router). From `react/`:

- Clone or download the repo
- `npm install`
- `npm start` to run the application with webpack-dev-server or `npm build` to kick off a fresh build and update the output directory (`dist/`)
- `npm run dev` to start the dev server on `localhost:5173`
- `npm run build` to type-check and build to `react/dist/` (service worker included); `npm run preview` serves the build, which is how to test service worker changes locally
- `npm test` runs Vitest + React Testing Library unit tests with an 80% coverage gate
- `npm run e2e` runs the Playwright end-to-end suite (run `npx playwright install chromium` once first)

Note: Any Service Worker changes will not be reflected when you run the application locally in development. To test service worker changes:
- `npm build`
- `npm run precache` to generate the service worker file
- `npm run static-serve` to load the application along with the service worker asset using [live-server](https://github.com/tapio/live-server)
See [`react/README.md`](react/README.md) for details.

## Contributors

Expand Down
134 changes: 0 additions & 134 deletions angular.json

This file was deleted.

12 changes: 0 additions & 12 deletions browserslist

This file was deleted.

32 changes: 0 additions & 32 deletions e2e/protractor.conf.js

This file was deleted.

23 changes: 0 additions & 23 deletions e2e/src/app.e2e-spec.ts

This file was deleted.

11 changes: 0 additions & 11 deletions e2e/src/app.po.ts

This file was deleted.

13 changes: 0 additions & 13 deletions e2e/tsconfig.json

This file was deleted.

30 changes: 18 additions & 12 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "dist",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "react/dist",
"headers": [
{
"source": "/sw.js",
"headers": [{ "key": "Cache-Control", "value": "no-cache" }]
}
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
32 changes: 0 additions & 32 deletions karma.conf.js

This file was deleted.

Loading
Loading