Skip to content
Open
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
30 changes: 30 additions & 0 deletions .github/workflows/react-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: react-app

on:
pull_request:
paths:
- 'react-app/**'
- '.github/workflows/react-app.yml'
push:
branches: [master]
paths:
- 'react-app/**'

jobs:
check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: react-app
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: react-app/package-lock.json
- run: npm ci
- run: npm run lint
- run: npm run typecheck
- run: npm test
- run: npm run build
4 changes: 4 additions & 0 deletions react-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
coverage
*.tsbuildinfo
14 changes: 14 additions & 0 deletions react-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# angular2-hn React app

React + TypeScript + Vite port of the Angular app in `../src`, built up over several PRs and moved to the repo root at cutover.

```bash
npm install
npm run dev # http://localhost:5173
npm run lint
npm run typecheck
npm test
npm run build
```

Feeds and items come from `node-hnapi.herokuapp.com`; user profiles come from `api.hnpwa.com` because node-hnapi's `/user/:id` returns 404.
25 changes: 25 additions & 0 deletions react-app/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint';

export default tseslint.config(
{ ignores: ['dist', 'coverage'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2022,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
},
}
);
17 changes: 17 additions & 0 deletions react-app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Angular 2 HN</title>
<meta name="description" content="A Hacker News client built with React, TypeScript and Vite" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#b92b27" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" type="image/png" href="/assets/icons/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="/assets/icons/favicon-16x16.png" sizes="16x16" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading
Loading