From a934307faa2e6eb17846f3e859c3a83e06a56676 Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Fri, 17 Mar 2023 12:07:36 +0500 Subject: [PATCH] feat: upgrade react router to v6 --- package-lock.json | 180 ++++++-------------------- package.json | 4 +- src/__snapshots__/index.test.jsx.snap | 18 ++- src/index.jsx | 14 +- 4 files changed, 56 insertions(+), 160 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7a06d3771..13aa4ab02 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@edx/browserslist-config": "^1.1.0", "@edx/frontend-component-footer": "^11.6.0", "@edx/frontend-enterprise-hotjar": "^1.2.0", - "@edx/frontend-platform": "^3.2.0", + "@edx/frontend-platform": "^3.6.0", "@edx/paragon": "20.19.0", "@fortawesome/fontawesome-svg-core": "^1.2.36", "@fortawesome/free-brands-svg-icons": "^5.15.4", @@ -45,7 +45,7 @@ "react-intl": "^5.20.9", "react-pdf": "^5.5.0", "react-redux": "^7.2.4", - "react-router-dom": "5.3.3", + "react-router-dom": "^6.0.0", "react-share": "^4.4.0", "react-zendesk": "^0.1.13", "redux": "4.1.1", @@ -2467,9 +2467,9 @@ } }, "node_modules/@edx/frontend-platform": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@edx/frontend-platform/-/frontend-platform-3.4.1.tgz", - "integrity": "sha512-A/B4YQWllbpGhHAVT664iwoEXwyuN2H1q4uoKC3PIEy4n+wv3BIvDhTA84htrc4F7Wdz+iP+DS3gQZbJ7VfMTA==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@edx/frontend-platform/-/frontend-platform-3.6.0.tgz", + "integrity": "sha512-CGE4AGxH7YHYdAF0hFz3CdoJ+95Ffx5lsE4ZfukR+r6z6UWhYC+BQ9iNcsiQgXgvM2zqqvwdICxRI4F1ODx1iA==", "dependencies": { "@cospired/i18n-iso-languages": "2.2.0", "@formatjs/intl-pluralrules": "4.3.3", @@ -18466,20 +18466,6 @@ "node": ">=4" } }, - "node_modules/mini-create-react-context": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz", - "integrity": "sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==", - "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", - "dependencies": { - "@babel/runtime": "^7.12.1", - "tiny-warning": "^1.0.3" - }, - "peerDependencies": { - "prop-types": "^15.0.0", - "react": "^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" - } - }, "node_modules/mini-css-extract-plugin": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-1.6.2.tgz", @@ -24641,74 +24627,34 @@ } }, "node_modules/react-router": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.3.3.tgz", - "integrity": "sha512-mzQGUvS3bM84TnbtMYR8ZjKnuPJ71IjSzR+DE6UkUqvN4czWIqEs17yLL8xkAycv4ev0AiN+IGrWu88vJs/p2w==", - "dependencies": { - "@babel/runtime": "^7.12.13", - "history": "^4.9.0", - "hoist-non-react-statics": "^3.1.0", - "loose-envify": "^1.3.1", - "mini-create-react-context": "^0.4.0", - "path-to-regexp": "^1.7.0", - "prop-types": "^15.6.2", - "react-is": "^16.6.0", - "tiny-invariant": "^1.0.2", - "tiny-warning": "^1.0.0" + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.0.0.tgz", + "integrity": "sha512-FcTRCihYZvERMNbG54D9+Wkv2cj/OtoxNlA/87D7vxKYlmSmbF9J9XChI9Is44j/behEiOhbovgVZBhKQn+wgA==", + "dependencies": { + "history": "^5.0.3" }, "peerDependencies": { - "react": ">=15" + "react": ">=16.8" } }, "node_modules/react-router-dom": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.3.3.tgz", - "integrity": "sha512-Ov0tGPMBgqmbu5CDmN++tv2HQ9HlWDuWIIqn4b88gjlAN5IHI+4ZUZRcpz9Hl0azFIwihbLDYw1OiHGRo7ZIng==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.0.0.tgz", + "integrity": "sha512-bPXyYipf0zu6K7mHSEmNO5YqLKq2q9N+Dsahw9Xh3oq1IirsI3vbnIYcVWin6A0zWyHmKhMGoV7Gr0j0kcuVFg==", "dependencies": { - "@babel/runtime": "^7.12.13", - "history": "^4.9.0", - "loose-envify": "^1.3.1", - "prop-types": "^15.6.2", - "react-router": "5.3.3", - "tiny-invariant": "^1.0.2", - "tiny-warning": "^1.0.0" + "react-router": "6.0.0" }, "peerDependencies": { - "react": ">=15" - } - }, - "node_modules/react-router-dom/node_modules/history": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz", - "integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==", - "dependencies": { - "@babel/runtime": "^7.1.2", - "loose-envify": "^1.2.0", - "resolve-pathname": "^3.0.0", - "tiny-invariant": "^1.0.2", - "tiny-warning": "^1.0.0", - "value-equal": "^1.0.1" + "react": ">=16.8", + "react-dom": ">=16.8" } }, "node_modules/react-router/node_modules/history": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz", - "integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==", - "dependencies": { - "@babel/runtime": "^7.1.2", - "loose-envify": "^1.2.0", - "resolve-pathname": "^3.0.0", - "tiny-invariant": "^1.0.2", - "tiny-warning": "^1.0.0", - "value-equal": "^1.0.1" - } - }, - "node_modules/react-router/node_modules/path-to-regexp": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", - "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/history/-/history-5.3.0.tgz", + "integrity": "sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ==", "dependencies": { - "isarray": "0.0.1" + "@babel/runtime": "^7.7.6" } }, "node_modules/react-share": { @@ -31570,9 +31516,9 @@ "requires": {} }, "@edx/frontend-platform": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@edx/frontend-platform/-/frontend-platform-3.4.1.tgz", - "integrity": "sha512-A/B4YQWllbpGhHAVT664iwoEXwyuN2H1q4uoKC3PIEy4n+wv3BIvDhTA84htrc4F7Wdz+iP+DS3gQZbJ7VfMTA==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@edx/frontend-platform/-/frontend-platform-3.6.0.tgz", + "integrity": "sha512-CGE4AGxH7YHYdAF0hFz3CdoJ+95Ffx5lsE4ZfukR+r6z6UWhYC+BQ9iNcsiQgXgvM2zqqvwdICxRI4F1ODx1iA==", "requires": { "@cospired/i18n-iso-languages": "2.2.0", "@formatjs/intl-pluralrules": "4.3.3", @@ -43770,15 +43716,6 @@ "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", "dev": true }, - "mini-create-react-context": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz", - "integrity": "sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==", - "requires": { - "@babel/runtime": "^7.12.1", - "tiny-warning": "^1.0.3" - } - }, "mini-css-extract-plugin": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-1.6.2.tgz", @@ -48199,72 +48136,29 @@ } }, "react-router": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.3.3.tgz", - "integrity": "sha512-mzQGUvS3bM84TnbtMYR8ZjKnuPJ71IjSzR+DE6UkUqvN4czWIqEs17yLL8xkAycv4ev0AiN+IGrWu88vJs/p2w==", - "requires": { - "@babel/runtime": "^7.12.13", - "history": "^4.9.0", - "hoist-non-react-statics": "^3.1.0", - "loose-envify": "^1.3.1", - "mini-create-react-context": "^0.4.0", - "path-to-regexp": "^1.7.0", - "prop-types": "^15.6.2", - "react-is": "^16.6.0", - "tiny-invariant": "^1.0.2", - "tiny-warning": "^1.0.0" + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.0.0.tgz", + "integrity": "sha512-FcTRCihYZvERMNbG54D9+Wkv2cj/OtoxNlA/87D7vxKYlmSmbF9J9XChI9Is44j/behEiOhbovgVZBhKQn+wgA==", + "requires": { + "history": "^5.0.3" }, "dependencies": { "history": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz", - "integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==", - "requires": { - "@babel/runtime": "^7.1.2", - "loose-envify": "^1.2.0", - "resolve-pathname": "^3.0.0", - "tiny-invariant": "^1.0.2", - "tiny-warning": "^1.0.0", - "value-equal": "^1.0.1" - } - }, - "path-to-regexp": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", - "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/history/-/history-5.3.0.tgz", + "integrity": "sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ==", "requires": { - "isarray": "0.0.1" + "@babel/runtime": "^7.7.6" } } } }, "react-router-dom": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.3.3.tgz", - "integrity": "sha512-Ov0tGPMBgqmbu5CDmN++tv2HQ9HlWDuWIIqn4b88gjlAN5IHI+4ZUZRcpz9Hl0azFIwihbLDYw1OiHGRo7ZIng==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.0.0.tgz", + "integrity": "sha512-bPXyYipf0zu6K7mHSEmNO5YqLKq2q9N+Dsahw9Xh3oq1IirsI3vbnIYcVWin6A0zWyHmKhMGoV7Gr0j0kcuVFg==", "requires": { - "@babel/runtime": "^7.12.13", - "history": "^4.9.0", - "loose-envify": "^1.3.1", - "prop-types": "^15.6.2", - "react-router": "5.3.3", - "tiny-invariant": "^1.0.2", - "tiny-warning": "^1.0.0" - }, - "dependencies": { - "history": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz", - "integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==", - "requires": { - "@babel/runtime": "^7.1.2", - "loose-envify": "^1.2.0", - "resolve-pathname": "^3.0.0", - "tiny-invariant": "^1.0.2", - "tiny-warning": "^1.0.0", - "value-equal": "^1.0.1" - } - } + "react-router": "6.0.0" } }, "react-share": { diff --git a/package.json b/package.json index c4b0f36d3..d236c244c 100755 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@edx/browserslist-config": "^1.1.0", "@edx/frontend-component-footer": "^11.6.0", "@edx/frontend-enterprise-hotjar": "^1.2.0", - "@edx/frontend-platform": "^3.2.0", + "@edx/frontend-platform": "^3.6.0", "@edx/paragon": "20.19.0", "@fortawesome/fontawesome-svg-core": "^1.2.36", "@fortawesome/free-brands-svg-icons": "^5.15.4", @@ -61,7 +61,7 @@ "react-intl": "^5.20.9", "react-pdf": "^5.5.0", "react-redux": "^7.2.4", - "react-router-dom": "5.3.3", + "react-router-dom": "^6.0.0", "react-share": "^4.4.0", "react-zendesk": "^0.1.13", "redux": "4.1.1", diff --git a/src/__snapshots__/index.test.jsx.snap b/src/__snapshots__/index.test.jsx.snap index fcad38416..9b833da83 100644 --- a/src/__snapshots__/index.test.jsx.snap +++ b/src/__snapshots__/index.test.jsx.snap @@ -21,16 +21,20 @@ exports[`app registry subscribe: APP_READY. links App to root element 1`] = ` } } > - - + + + + } path="/" - > - - - + - + `; diff --git a/src/index.jsx b/src/index.jsx index af33665fb..c3f68eff2 100755 --- a/src/index.jsx +++ b/src/index.jsx @@ -4,12 +4,12 @@ import 'regenerator-runtime/runtime'; import React from 'react'; import ReactDOM from 'react-dom'; -import { Switch, Redirect } from 'react-router-dom'; +import { Route, Navigate, Routes } from 'react-router-dom'; import { AppProvider, ErrorPage, - PageRoute, + PageWrap, } from '@edx/frontend-platform/react'; import store from 'data/store'; import { @@ -32,12 +32,10 @@ subscribe(APP_READY, () => { ReactDOM.render( - - - - - - + + } /> + + , document.getElementById('root'),