-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate Conduit (Angular) to React 18 + Vite in react-app/ #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
0f81c89
7dbee19
f1a7071
f7f4351
0f05267
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: React App | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, master] | ||
| pull_request: | ||
| branches: [main, master] | ||
|
|
||
| jobs: | ||
| build-lint-test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: react-app | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: true | ||
|
|
||
| - name: Setup Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install | ||
|
|
||
| - name: Lint | ||
| run: bun run lint | ||
|
|
||
| - name: Unit tests | ||
| run: bun run test | ||
|
|
||
| - name: Build | ||
| run: bun run build |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,8 @@ import { defineConfig } from '@playwright/test'; | |
| import { baseConfig } from './e2e/playwright.base'; | ||
|
|
||
| /** | ||
| * Angular-specific Playwright configuration. | ||
| * Extends the shared RealWorld base config with the Angular dev server. | ||
| * Playwright configuration for the migrated React + Vite app. | ||
| * Extends the shared RealWorld base config with the React dev server. | ||
| */ | ||
| export default defineConfig({ | ||
| ...baseConfig, | ||
|
|
@@ -14,7 +14,8 @@ export default defineConfig({ | |
| }, | ||
|
|
||
| webServer: { | ||
| command: 'npm run start', | ||
| command: 'bun run dev', | ||
| cwd: 'react-app', | ||
|
Comment on lines
+17
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚩 Playwright config now runs React app instead of Angular — Angular E2E coverage removed The root Was this helpful? React with 👍 or 👎 to provide feedback. Debug |
||
| url: 'http://localhost:4200', | ||
| reuseExistingServer: !process.env.CI, | ||
| timeout: 120_000, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| pnpm-debug.log* | ||
| lerna-debug.log* | ||
|
|
||
| node_modules | ||
| dist | ||
| dist-ssr | ||
| *.local | ||
| *.tsbuildinfo | ||
|
|
||
| # Editor directories and files | ||
| .vscode/* | ||
| !.vscode/extensions.json | ||
| .idea | ||
| .DS_Store | ||
| *.suo | ||
| *.ntvs* | ||
| *.njsproj | ||
| *.sln | ||
| *.sw? | ||
|
|
||
| # Vitest / coverage | ||
| coverage |
Large diffs are not rendered by default.
| 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'] }, | ||
| { | ||
| 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 }], | ||
| }, | ||
| }, | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <title>Conduit</title> | ||
| <base href="/" /> | ||
|
|
||
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| <link href="//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css" /> | ||
| <link | ||
| href="//fonts.googleapis.com/css?family=Titillium+Web:700|Lora:400,400italic,700,700italic|Source+Sans+Pro:400,300,600,700,300italic,400italic,600italic,700italic" | ||
| rel="stylesheet" | ||
| type="text/css" | ||
| /> | ||
| </head> | ||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.tsx"></script> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| { | ||
| "name": "react-conduit", | ||
| "version": "0.0.0", | ||
| "license": "MIT", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "dev": "vite", | ||
| "start": "vite", | ||
| "build": "tsc -b && vite build", | ||
| "preview": "vite preview", | ||
| "lint": "eslint . --max-warnings 0", | ||
| "test": "vitest run", | ||
| "test:watch": "vitest" | ||
| }, | ||
| "engines": { | ||
| "node": ">=20.11.1" | ||
| }, | ||
| "dependencies": { | ||
| "dompurify": "^3.2.4", | ||
| "marked": "^17.0.1", | ||
| "react": "^18.3.1", | ||
| "react-dom": "^18.3.1", | ||
| "react-router-dom": "^6.30.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@eslint/js": "^9.18.0", | ||
| "@testing-library/jest-dom": "^6.6.3", | ||
| "@testing-library/react": "^16.1.0", | ||
| "@types/react": "^18.3.18", | ||
| "@types/react-dom": "^18.3.5", | ||
| "@vitejs/plugin-react": "^4.3.4", | ||
| "eslint": "^9.18.0", | ||
| "eslint-plugin-react-hooks": "^5.1.0", | ||
| "eslint-plugin-react-refresh": "^0.4.18", | ||
| "globals": "^15.14.0", | ||
| "jsdom": "^25.0.1", | ||
| "typescript": "~5.9.3", | ||
| "typescript-eslint": "^8.21.0", | ||
| "vite": "^6.0.7", | ||
| "vitest": "^2.1.8" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /* /index.html 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚩 Playwright E2E tests now target the React app instead of Angular
The
playwright.config.tschange switches the web server fromnpm run start(Angular CLI dev server) tobun run devwithcwd: 'react-app'(Vite dev server). This means all E2E tests in thee2e/directory now run exclusively against the React app. Any behavioral differences between the Angular and React implementations could cause E2E test regressions. The Angular app's dev server is no longer exercised by CI at all. This is presumably intentional as part of the migration, but worth confirming that the Angular app isn't meant to continue being tested independently.Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed intentional. The goal of this PR is to validate the React port against the existing e2e suite, so the Playwright
webServernow boots the React app. The Angular build/unit tests still run via the existingtestjob (rootbun run test) and the Angular source is untouched. If you'd prefer to keep an Angular e2e job running in parallel during the transition, that's easy to add — let me know and I'll wire up a secondwebServer/project. Final disposition of the Angular source (keep vs. remove) is the open question on the PR.