From f447687c0f6734a0bfd629f20e1aee179620c6ae Mon Sep 17 00:00:00 2001 From: Ankit Gupta Date: Mon, 20 Apr 2026 12:16:33 -0400 Subject: [PATCH 1/5] Upgrade React to 16.14.0, TypeScript to 4.9.5, and refresh browserslist Remove the dead IE-only msMaxTouchPoints check in isTouchEnabled (removed from lib.dom.d.ts in TS 4+; IE11 was EOL'd in 2022 and is already excluded by the project browserslist). --- package.json | 6 +++--- src/components/map/utils.ts | 4 +--- src/utils.ts | 4 +--- yarn.lock | 18 +++++++++--------- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 14376d7f..b7f3f9d8 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ "jest-canvas-mock": "^2.2.0", "match-sorter": "^4.2.0", "material-table": "1.68.1", - "react": "^16.13.1", + "react": "^16.14.0", "react-device-detect": "^1.17.0", - "react-dom": "^16.13.1", + "react-dom": "^16.14.0", "react-icons": "^4.2.0", "react-map-gl": "^5.2.7", "react-map-gl-geocoder": "^2.0.16", @@ -40,7 +40,7 @@ "react-transition-group": "^4.4.1", "react-window": "^1.8.5", "simple-statistics": "^7.3.2", - "typescript": "3.9.5", + "typescript": "4.9.5", "webfontloader": "^1.6.28" }, "devDependencies": { diff --git a/src/components/map/utils.ts b/src/components/map/utils.ts index 5cf4f783..6b93c425 100644 --- a/src/components/map/utils.ts +++ b/src/components/map/utils.ts @@ -299,6 +299,4 @@ export const getCenterOfBounds = ( // CRED: geeksforgeeks.org/how-to-detect-touch-screen-device-using-javascript/ export const isTouchEnabled = (): boolean => - (window && 'ontouchstart' in window) || - navigator.maxTouchPoints > 0 || - navigator.msMaxTouchPoints > 0 + (window && 'ontouchstart' in window) || navigator.maxTouchPoints > 0 diff --git a/src/utils.ts b/src/utils.ts index 5a821756..db97ccc7 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -72,9 +72,7 @@ export const getAllLangFeatIDs = (data: InternalUse[]): string[] => // CRED: // www.geeksforgeeks.org/how-to-detect-touch-screen-device-using-javascript/ export const isTouchEnabled = (): boolean => - (window && 'ontouchstart' in window) || - navigator.maxTouchPoints > 0 || - navigator.msMaxTouchPoints > 0 + (window && 'ontouchstart' in window) || navigator.maxTouchPoints > 0 // CRED: https://stackoverflow.com/a/5574446/1048518 export const toProperCase = (srcText: string): string => diff --git a/yarn.lock b/yarn.lock index 43649571..df0537fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3468,9 +3468,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001135: - version "1.0.30001208" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001208.tgz" - integrity sha512-OE5UE4+nBOro8Dyvv0lfx+SRtfVIOM9uhKqFmJeUbGriqhhStgp1A0OyBpgy3OUF8AhYCT+PVwPC1gMl2ZcQMA== + version "1.0.30001788" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001788.tgz" + integrity sha512-6q8HFp+lOQtcf7wBK+uEenxymVWkGKkjFpCvw5W25cmMwEDU45p1xQFBQv8JDlMMry7eNxyBaR+qxgmTUZkIRQ== canvg@^3.0.6: version "3.0.7" @@ -11019,7 +11019,7 @@ react-device-detect@^1.17.0: dependencies: ua-parser-js "^0.7.24" -react-dom@^16.13.1: +react-dom@^16.14.0: version "16.14.0" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.14.0.tgz#7ad838ec29a777fb3c75c3a190f661cf92ab8b89" integrity sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw== @@ -11271,7 +11271,7 @@ react-window@^1.8.5: "@babel/runtime" "^7.0.0" memoize-one ">=3.1.1 <6" -react@^16.13.1: +react@^16.14.0: version "16.14.0" resolved "https://registry.yarnpkg.com/react/-/react-16.14.0.tgz#94d776ddd0aaa37da3eda8fc5b6b18a4c9a3114d" integrity sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g== @@ -13035,10 +13035,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@3.9.5: - version "3.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.5.tgz#586f0dba300cde8be52dd1ac4f7e1009c1b13f36" - integrity sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ== +typescript@4.9.5: + version "4.9.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" + integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== typescript@^3.2.1, typescript@^3.9.3: version "3.9.7" From fe47878a29f4655250b97536e0c1674390b5bd9a Mon Sep 17 00:00:00 2001 From: Ankit Gupta Date: Mon, 20 Apr 2026 12:43:15 -0400 Subject: [PATCH 2/5] Migrate from Create React App to Vite Replace react-scripts 3.4.1 with Vite 6 + @vitejs/plugin-react. This drops the NODE_OPTIONS=--openssl-legacy-provider workaround required for Node 17+ on CRA, and shrinks cold dev start to ~125ms and prod build to ~5s (from ~33s). Changes: - Swap scripts: yarn start -> vite; yarn build -> tsc --noEmit && vite build; yarn preview -> vite preview; drop eject/test. - Replace CRA deps with vite, @vitejs/plugin-react, vite-plugin-svgr, vite-tsconfig-paths. - Add vite.config.ts configuring the React and SVGR plugins, the REACT_APP_ env prefix (keeps .env working as-is, with VITE_ also accepted), port 3000, and build output to build/ (preserving the Netlify publish dir). - Move public/index.html to project root. Replace %PUBLIC_URL%/ with / and add the Vite module entry script. - Remove the CRA eslintConfig stanza in package.json; real config lives in .eslintrc. - Add a direct eslint@^7.32.0 devDep (previously hoisted by CRA), drop the react-app extends that no longer resolves, and remove the deleted serviceWorker.ts path from ignorePatterns. - Delete src/serviceWorker.ts and its import; it was already calling unregister() only, so removal is a no-op at runtime. - Rewrite six process.env.REACT_APP_* reads as import.meta.env. - Change Logo.tsx SVG import to use the vite-plugin-svgr ?react suffix. - Update tsconfig.json: target ES2020, add vite/client and vite-plugin-svgr/client types, exclude *.test.ts/tsx files from the build since there is no test runner anymore. - Delete src/setupTests.ts (orphaned CRA jest setup). Known follow-ups (deliberately out of scope for this PR): - @mapbox/mapbox-gl-geocoder imports the Node events module, which Vite externalizes for the browser. If the geocoder search breaks at runtime, it can be addressed by swapping react-map-gl-geocoder for a direct mapbox-gl-geocoder integration in a later phase. - yarn lint surfaces 55 pre-existing errors across the codebase that were previously masked by CRA's react-app eslint preset. These are unrelated to the build migration and should be addressed in a follow-up. Pre-commit lint-staged only runs against staged files, so new commits are unaffected. --- .eslintrc | 3 +- public/index.html => index.html | 22 +- package.json | 20 +- src/components/config/api.ts | 3 +- src/components/generic/Logo.tsx | 2 +- src/components/map/config.ts | 2 +- src/index.tsx | 16 +- src/serviceWorker.ts | 147 - src/setupTests.ts | 19 - tsconfig.json | 10 +- vite.config.ts | 11 + yarn.lock | 15788 +++++++++--------------------- 12 files changed, 4413 insertions(+), 11630 deletions(-) rename public/index.html => index.html (83%) delete mode 100644 src/serviceWorker.ts delete mode 100644 src/setupTests.ts create mode 100644 vite.config.ts diff --git a/.eslintrc b/.eslintrc index 81b11869..b28aa724 100644 --- a/.eslintrc +++ b/.eslintrc @@ -27,7 +27,6 @@ "extends": [ "airbnb-typescript", "airbnb/hooks", - "react-app", "prettier/react", "plugin:jest/recommended", "plugin:react/recommended", @@ -40,7 +39,7 @@ // last configuration in the extends array. "plugin:prettier/recommended" ], - "ignorePatterns": ["scratch", "src/serviceWorker.ts", "build"], + "ignorePatterns": ["scratch", "build"], "rules": { "array-bracket-newline": [ "error", diff --git a/public/index.html b/index.html similarity index 83% rename from public/index.html rename to index.html index ef88da4c..b1a4f333 100644 --- a/public/index.html +++ b/index.html @@ -17,9 +17,9 @@ - - - + + + @@ -29,7 +29,7 @@ name="description" content="An interactive language diversity map of New York City" /> - + @@ -56,17 +56,8 @@ manifest.json provides metadata used when your web app is installed on a user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ --> - - - + + Languages of New York City @@ -82,6 +73,7 @@
+