Conversation
Signed-off-by: JP-Ellis <josh@jpellis.me>
a3c5506 to
6a7f94d
Compare
There was a problem hiding this comment.
Pull request overview
Modernises the repository by migrating the React app from CRA/JS to Vite/TypeScript, replacing ESLint/Prettier with Biome, and updating Cypress + Pact integration for newer Cypress versions.
Changes:
- Migrate build tooling to Vite + TypeScript (new Vite config, TS configs, new Vite entry
index.html). - Convert React source from
.jsto.ts/.tsxand update routing/rendering to current React Router +createRoot. - Update Cypress setup to
cypress.config.tsand replace legacycy.server()/cy.route()approach withcy.intercept()+ Node-side Pact tasks.
Reviewed changes
Copilot reviewed 39 out of 43 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| vite.config.ts | Adds Vite configuration (React plugin, dev server port, build output). |
| tsconfig.json | Introduces strict TS config for app source. |
| tsconfig.cypress.json | Adds Cypress-specific TS config (node resolution, Cypress types). |
| src/setupTests.js | Removes CRA/Jest setup. |
| src/index.tsx | Adds Vite/React entrypoint using createRoot and Routes. |
| src/index.js | Removes legacy CRA entrypoint. |
| src/index.css | Formatting updates (quotes/line wrapping). |
| src/api.ts | Replaces JS API client with typed TS implementation using Vite env vars. |
| src/api.js | Removes legacy JS API client. |
| src/ProductPage.tsx | Converts Product page to functional TS component using hooks + router hooks. |
| src/ProductPage.js | Removes legacy class component implementation. |
| src/Layout.tsx | Adds typed Layout component. |
| src/Layout.js | Removes legacy Layout component + PropTypes. |
| src/Heading.tsx | Adds typed Heading component. |
| src/Heading.js | Removes legacy Heading component + PropTypes. |
| src/ErrorPage.tsx | Converts Error page to functional TS component using useLocation. |
| src/ErrorPage.js | Removes legacy Error page implementation. |
| src/App.tsx | Converts App to functional TS component using hooks + updated routing patterns. |
| src/App.js | Removes legacy class App + PropTypes. |
| public/index.html | Removes CRA HTML template. |
| package.json | Updates dependencies/scripts for Vite, TS, Biome, Cypress v14, Node engine. |
| index.html | Adds Vite root HTML entrypoint. |
| cypress/support/pact-tasks.ts | Adds Cypress node event tasks for Pact mock server lifecycle. |
| cypress/support/index.js | Removes legacy Cypress support index file. |
| cypress/support/index.d.ts | Adds TS typings for custom Cypress commands. |
| cypress/support/e2e.ts | Adds Cypress support entrypoint for e2e (imports commands). |
| cypress/support/commands.ts | Reimplements custom Cypress Pact commands using cy.intercept() + tasks. |
| cypress/support/commands.js | Removes legacy Cypress Pact command implementation (CJS). |
| cypress/plugins/index.js | Removes legacy Cypress plugins entrypoint. |
| cypress/plugins/cypress-pact.js | Removes legacy Pact plugin implementation. |
| cypress/integration/test/products.js | Keeps legacy integration spec (now largely obsolete with new config). |
| cypress/fixtures/example.json | Minor formatting change. |
| cypress/e2e/products.cy.ts | Adds new Cypress v10+ style e2e spec in TS. |
| cypress.json | Removes legacy Cypress config. |
| cypress.config.ts | Adds Cypress v10+ config with setupNodeEvents + env defaults. |
| cypress-stubbed.json | Removes legacy stubbed Cypress config. |
| biome.jsonc | Adds Biome config (lint/format rules). |
| Makefile | Updates env var naming for Vite (VITE_API_BASE_URL). |
| .github/workflows/build.yml | Updates CI to Node 24, uses npm ci, adds type-check/lint/build gates, adds completion job. |
| .github/renovate.json | Minor JSON formatting cleanup. |
| .eslintrc.json | Removes ESLint config (replaced by Biome). |
| .editorconfig | Adds editorconfig defaults (2-space indent, LF, etc.). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0b36ef5 to
e3cc181
Compare
This includes: - converting class components to functional components with hooks - using TS interfaces instead of prop types - Update some React Router APIs to v7 - Update some env vars to use VITE_ in preparation for vite support Signed-off-by: JP-Ellis <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
570fcc0 to
563f0d2
Compare
Signed-off-by: JP-Ellis <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
- Upgrade Node.js from 14 to 24 - Use npm ci instead of npm i - Add quality gate steps: type-check, check (Biome), build before test - Add complete job as single required status check Signed-off-by: JP-Ellis <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
563f0d2 to
04c4410
Compare
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.
This PR modernises the example repo.
The following main replacements have been performed:
react-scripts(CRA) — replaced by Viteprop-types— replaced by TypeScriptdotenv— no longer needed with Vite's env handlingeslintConfigfield andbrowserslistfield frompackage.json.eslintrc.jsonandprettier— replaced by Biomecypress.json/cypress-stubbed.json— replaced bycypress.config.tscypress/plugins/— replaced bysetupNodeEventsincypress.config.tscy.server()/cy.route()(removed in Cypress v9) — replaced bycy.intercept()rimraf,rambda,@pact-foundation/pact-node— no longer neededAll remaining dependencies should be up to date.
All source files converted from
.jsto.ts/.tsx:api.ts— full method signatures;REACT_APP_API_BASE_URL→import.meta.env.VITE_API_BASE_URL;substr→slice; removesdeprecated
axios/lib/adapters/httpimportApp.tsx,ProductPage.tsx,ErrorPage.tsx— class components → functional withuseState/useEffect; PropTypes removed;withRouter→useNavigate/useParamsHeading.tsx,Layout.tsx— typed functional components; PropTypes removedindex.tsx—ReactDOM.render→createRoot;<Switch>/<Route component>→<Routes>/<Route element>Cypress files updated for v14:
cypress/support/pact-tasks.ts— replacescypress/plugins/cypress-pact.js;rimraf→node:fs/promises rm(); converted from CJSto ESM
cypress/support/commands.ts— removescy.server()/cy.route()and browser-level request interception; app now calls the Pact mockserver directly on a fixed port so
cy.intercept()is used for aliasing onlycypress/e2e/products.cy.ts— moved fromcypress/integration/test/products.js; imports from@pact-foundation/pactinstead of@pact-foundation/pact-web;cy.visituses relative path viabaseUrlConfig files added:
tsconfig.json— strict mode,moduleResolution: bundler,noEmit,jsx: react-jsx,vite/clienttypestsconfig.cypress.json— CommonJS module resolution for Cypress support filesvite.config.ts— React plugin, port 3000,outDir: build,envPrefix: ["VITE_", "PACT_", "PROVIDER_"]biome.jsonc— VCS gitignore integration; recommended rules;noExcessiveLinesPerFunctionsuppressed forcypress/**where testsuites are intentionally long
.editorconfig— UTF-8, LF, 2-space indent, final newlineindex.html— root Vite entry point (replacespublic/index.html)Other:
package.json—"type": "module","engines": {"node": ">=24.0.0"}; full script suite includingdev,type-check,lint,checkMakefile—REACT_APP_API_BASE_URL→VITE_API_BASE_URL.github/workflows/build.yml— Node 14 → 24;npm i→npm ci; env var renamed; quality gates added before test:type-check,check,build;completejob follows standardTest completion checkpatternRef: PACT-6017