From 93de23557362644102be3d6e5570fc54531a9652 Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Sun, 25 Feb 2024 19:44:26 +0900 Subject: [PATCH 1/9] upgrade to React v17 / react-intl --- package-lock.json | 269 +++++++++++++++++++++++++++++----------------- package.json | 17 +-- src/index.tsx | 28 ++--- 3 files changed, 197 insertions(+), 117 deletions(-) diff --git a/package-lock.json b/package-lock.json index 765927b..fb06c39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,11 +33,11 @@ "polished": "^4.0.5", "qs": "^6.9.4", "rc-upload": "^3.2.0", - "react": "^16.12.0", + "react": "^17", "react-cookie": "^4.0.3", - "react-dom": "^16.12.0", + "react-dom": "^17", "react-filepond": "^7.0.1", - "react-intl": "^3.12.0", + "react-intl": "^5", "react-redux": "^7.2.0", "react-resize-detector": "^4.2.1", "react-router-dom": "^5.1.2", @@ -55,10 +55,10 @@ "@types/classnames": "^2.2.9", "@types/jwt-decode": "^2.2.1", "@types/lodash-es": "^4.14.149", - "@types/node": "^18", + "@types/node": "^20", "@types/qs": "^6.9.5", - "@types/react": "^16", - "@types/react-dom": "^16", + "@types/react": "<18", + "@types/react-dom": "<18", "@types/react-filepond": "^5.0.5", "@types/react-redux": "^7.1.7", "@types/react-resize-detector": "^4.2.0", @@ -1016,44 +1016,131 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@formatjs/intl-displaynames": { - "version": "1.2.10", - "resolved": "https://registry.npmjs.org/@formatjs/intl-displaynames/-/intl-displaynames-1.2.10.tgz", - "integrity": "sha512-GROA2RP6+7Ouu0WnHFF78O5XIU7pBfI19WM1qm93l6MFWibUk67nCfVCK3VAYJkLy8L8ZxjkYT11VIAfvSz8wg==", + "node_modules/@formatjs/ecma402-abstract": { + "version": "1.11.4", + "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-1.11.4.tgz", + "integrity": "sha512-EBikYFp2JCdIfGEb5G9dyCkTGDmC57KSHhRQOC3aYxoPWVZvfWCDjZwkGYHN7Lis/fmuWl906bnNTJifDQ3sXw==", "dependencies": { - "@formatjs/intl-utils": "^2.3.0" + "@formatjs/intl-localematcher": "0.2.25", + "tslib": "^2.1.0" } }, - "node_modules/@formatjs/intl-listformat": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/@formatjs/intl-listformat/-/intl-listformat-1.4.8.tgz", - "integrity": "sha512-WNMQlEg0e50VZrGIkgD5n7+DAMGt3boKi1GJALfhFMymslJb5i+5WzWxyj/3a929Z6MAFsmzRIJjKuv+BxKAOQ==", + "node_modules/@formatjs/ecma402-abstract/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/@formatjs/fast-memoize": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@formatjs/fast-memoize/-/fast-memoize-1.2.1.tgz", + "integrity": "sha512-Rg0e76nomkz3vF9IPlKeV+Qynok0r7YZjL6syLz4/urSg0IbjPZCB/iYUMNsYA643gh4mgrX3T7KEIFIxJBQeg==", "dependencies": { - "@formatjs/intl-utils": "^2.3.0" + "tslib": "^2.1.0" } }, - "node_modules/@formatjs/intl-relativetimeformat": { - "version": "4.5.16", - "resolved": "https://registry.npmjs.org/@formatjs/intl-relativetimeformat/-/intl-relativetimeformat-4.5.16.tgz", - "integrity": "sha512-IQ0haY97oHAH5OYUdykNiepdyEWj3SAT+Fp9ZpR85ov2JNiFx+12WWlxlVS8ehdyncC2ZMt/SwFIy2huK2+6/A==", + "node_modules/@formatjs/fast-memoize/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/@formatjs/icu-messageformat-parser": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.1.0.tgz", + "integrity": "sha512-Qxv/lmCN6hKpBSss2uQ8IROVnta2r9jd3ymUEIjm2UyIkUCHVcbUVRGL/KS/wv7876edvsPe+hjHVJ4z8YuVaw==", "dependencies": { - "@formatjs/intl-utils": "^2.3.0" + "@formatjs/ecma402-abstract": "1.11.4", + "@formatjs/icu-skeleton-parser": "1.3.6", + "tslib": "^2.1.0" } }, - "node_modules/@formatjs/intl-unified-numberformat": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/@formatjs/intl-unified-numberformat/-/intl-unified-numberformat-3.3.7.tgz", - "integrity": "sha512-KnWgLRHzCAgT9eyt3OS34RHoyD7dPDYhRcuKn+/6Kv2knDF8Im43J6vlSW6Hm1w63fNq3ZIT1cFk7RuVO3Psag==", - "deprecated": "We have renamed the package to @formatjs/intl-numberformat", + "node_modules/@formatjs/icu-messageformat-parser/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/@formatjs/icu-skeleton-parser": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.3.6.tgz", + "integrity": "sha512-I96mOxvml/YLrwU2Txnd4klA7V8fRhb6JG/4hm3VMNmeJo1F03IpV2L3wWt7EweqNLES59SZ4d6hVOPCSf80Bg==", "dependencies": { - "@formatjs/intl-utils": "^2.3.0" + "@formatjs/ecma402-abstract": "1.11.4", + "tslib": "^2.1.0" } }, - "node_modules/@formatjs/intl-utils": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@formatjs/intl-utils/-/intl-utils-2.3.0.tgz", - "integrity": "sha512-KWk80UPIzPmUg+P0rKh6TqspRw0G6eux1PuJr+zz47ftMaZ9QDwbGzHZbtzWkl5hgayM/qrKRutllRC7D/vVXQ==", - "deprecated": "the package is rather renamed to @formatjs/ecma-abstract with some changes in functionality (primarily selectUnit is removed and we don't plan to make any further changes to this package" + "node_modules/@formatjs/icu-skeleton-parser/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/@formatjs/intl": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@formatjs/intl/-/intl-2.2.1.tgz", + "integrity": "sha512-vgvyUOOrzqVaOFYzTf2d3+ToSkH2JpR7x/4U1RyoHQLmvEaTQvXJ7A2qm1Iy3brGNXC/+/7bUlc3lpH+h/LOJA==", + "dependencies": { + "@formatjs/ecma402-abstract": "1.11.4", + "@formatjs/fast-memoize": "1.2.1", + "@formatjs/icu-messageformat-parser": "2.1.0", + "@formatjs/intl-displaynames": "5.4.3", + "@formatjs/intl-listformat": "6.5.3", + "intl-messageformat": "9.13.0", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "typescript": "^4.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@formatjs/intl-displaynames": { + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/@formatjs/intl-displaynames/-/intl-displaynames-5.4.3.tgz", + "integrity": "sha512-4r12A3mS5dp5hnSaQCWBuBNfi9Amgx2dzhU4lTFfhSxgb5DOAiAbMpg6+7gpWZgl4ahsj3l2r/iHIjdmdXOE2Q==", + "dependencies": { + "@formatjs/ecma402-abstract": "1.11.4", + "@formatjs/intl-localematcher": "0.2.25", + "tslib": "^2.1.0" + } + }, + "node_modules/@formatjs/intl-displaynames/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/@formatjs/intl-listformat": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/@formatjs/intl-listformat/-/intl-listformat-6.5.3.tgz", + "integrity": "sha512-ozpz515F/+3CU+HnLi5DYPsLa6JoCfBggBSSg/8nOB5LYSFW9+ZgNQJxJ8tdhKYeODT+4qVHX27EeJLoxLGLNg==", + "dependencies": { + "@formatjs/ecma402-abstract": "1.11.4", + "@formatjs/intl-localematcher": "0.2.25", + "tslib": "^2.1.0" + } + }, + "node_modules/@formatjs/intl-listformat/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/@formatjs/intl-localematcher": { + "version": "0.2.25", + "resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.2.25.tgz", + "integrity": "sha512-YmLcX70BxoSopLFdLr1Ds99NdlTI2oWoLbaUW2M406lxOIPzE1KQhRz2fPUkq34xVZQaihCoU29h0KK7An3bhA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@formatjs/intl-localematcher/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/@formatjs/intl/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/@fortawesome/fontawesome-common-types": { "version": "0.2.36", @@ -1662,11 +1749,6 @@ "hoist-non-react-statics": "^3.3.0" } }, - "node_modules/@types/invariant": { - "version": "2.2.37", - "resolved": "https://registry.npmjs.org/@types/invariant/-/invariant-2.2.37.tgz", - "integrity": "sha512-IwpIMieE55oGWiXkQPSBY1nw1nFs6bsKXTFskNY8sdS17K24vyEBRQZEwlRS7ZmXCWnJcQtbxWzly+cODWGs2A==" - }, "node_modules/@types/js-cookie": { "version": "2.2.6", "resolved": "https://registry.npmjs.org/@types/js-cookie/-/js-cookie-2.2.6.tgz", @@ -1706,9 +1788,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.19.17", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.17.tgz", - "integrity": "sha512-SzyGKgwPzuWp2SHhlpXKzCX0pIOfcI4V2eF37nNBJOhwlegQ83omtVQ1XxZpDE06V/d6AQvfQdPfnw0tRC//Ng==", + "version": "20.11.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.20.tgz", + "integrity": "sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -5172,28 +5254,21 @@ "node": ">= 0.4" } }, - "node_modules/intl-format-cache": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/intl-format-cache/-/intl-format-cache-4.3.1.tgz", - "integrity": "sha512-OEUYNA7D06agqPOYhbTkl0T8HA3QKSuwWh1HiClEnpd9vw7N+3XsQt5iZ0GUEchp5CW1fQk/tary+NsbF3yQ1Q==" - }, "node_modules/intl-messageformat": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-7.8.4.tgz", - "integrity": "sha512-yS0cLESCKCYjseCOGXuV4pxJm/buTfyCJ1nzQjryHmSehlptbZbn9fnlk1I9peLopZGGbjj46yHHiTAEZ1qOTA==", + "version": "9.13.0", + "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-9.13.0.tgz", + "integrity": "sha512-7sGC7QnSQGa5LZP7bXLDhVDtQOeKGeBFGHF2Y8LVBwYZoQZCgWeKoPGTa5GMG8g/TzDgeXuYJQis7Ggiw2xTOw==", "dependencies": { - "intl-format-cache": "^4.2.21", - "intl-messageformat-parser": "^3.6.4" + "@formatjs/ecma402-abstract": "1.11.4", + "@formatjs/fast-memoize": "1.2.1", + "@formatjs/icu-messageformat-parser": "2.1.0", + "tslib": "^2.1.0" } }, - "node_modules/intl-messageformat-parser": { - "version": "3.6.4", - "resolved": "https://registry.npmjs.org/intl-messageformat-parser/-/intl-messageformat-parser-3.6.4.tgz", - "integrity": "sha512-RgPGwue0mJtoX2Ax8EmMzJzttxjnva7gx0Q7mKJ4oALrTZvtmCeAw5Msz2PcjW4dtCh/h7vN/8GJCxZO1uv+OA==", - "deprecated": "We've written a new parser that's 6x faster and is backwards compatible. Please use @formatjs/icu-messageformat-parser", - "dependencies": { - "@formatjs/intl-unified-numberformat": "^3.2.0" - } + "node_modules/intl-messageformat/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/ip-address": { "version": "9.0.5", @@ -7768,9 +7843,9 @@ } }, "node_modules/rc-util": { - "version": "5.38.1", - "resolved": "https://registry.npmjs.org/rc-util/-/rc-util-5.38.1.tgz", - "integrity": "sha512-e4ZMs7q9XqwTuhIK7zBIVFltUtMSjphuPPQXHoHlzRzNdOwUxDejo0Zls5HYaJfRKNURcsS/ceKVULlhjBrxng==", + "version": "5.38.2", + "resolved": "https://registry.npmjs.org/rc-util/-/rc-util-5.38.2.tgz", + "integrity": "sha512-yRGRPKyi84H7NkRSP6FzEIYBdUt4ufdsmXUZ7qM2H5qoByPax70NnGPkfo36N+UKUnUBj2f2Q2eUbwYMuAsIOQ==", "dependencies": { "@babel/runtime": "^7.18.3", "react-is": "^18.2.0" @@ -7804,13 +7879,12 @@ } }, "node_modules/react": { - "version": "16.14.0", - "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", - "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==", + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", + "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", "dependencies": { "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2" + "object-assign": "^4.1.1" }, "engines": { "node": ">=0.10.0" @@ -7830,17 +7904,16 @@ } }, "node_modules/react-dom": { - "version": "16.14.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz", - "integrity": "sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==", + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", + "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==", "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", - "prop-types": "^15.6.2", - "scheduler": "^0.19.1" + "scheduler": "^0.20.2" }, "peerDependencies": { - "react": "^16.14.0" + "react": "17.0.2" } }, "node_modules/react-easy-crop": { @@ -7872,27 +7945,36 @@ } }, "node_modules/react-intl": { - "version": "3.12.1", - "resolved": "https://registry.npmjs.org/react-intl/-/react-intl-3.12.1.tgz", - "integrity": "sha512-cgumW29mwROIqyp8NXStYsoIm27+8FqnxykiLSawWjOxGIBeLuN/+p2srei5SRIumcJefOkOIHP+NDck05RgHg==", - "dependencies": { - "@formatjs/intl-displaynames": "^1.2.0", - "@formatjs/intl-listformat": "^1.4.1", - "@formatjs/intl-relativetimeformat": "^4.5.9", - "@formatjs/intl-unified-numberformat": "^3.2.0", - "@formatjs/intl-utils": "^2.2.0", + "version": "5.25.1", + "resolved": "https://registry.npmjs.org/react-intl/-/react-intl-5.25.1.tgz", + "integrity": "sha512-pkjdQDvpJROoXLMltkP/5mZb0/XqrqLoPGKUCfbdkP8m6U9xbK40K51Wu+a4aQqTEvEK5lHBk0fWzUV72SJ3Hg==", + "dependencies": { + "@formatjs/ecma402-abstract": "1.11.4", + "@formatjs/icu-messageformat-parser": "2.1.0", + "@formatjs/intl": "2.2.1", + "@formatjs/intl-displaynames": "5.4.3", + "@formatjs/intl-listformat": "6.5.3", "@types/hoist-non-react-statics": "^3.3.1", - "@types/invariant": "^2.2.31", + "@types/react": "16 || 17 || 18", "hoist-non-react-statics": "^3.3.2", - "intl-format-cache": "^4.2.21", - "intl-messageformat": "^7.8.4", - "intl-messageformat-parser": "^3.6.4", - "shallow-equal": "^1.2.1" + "intl-messageformat": "9.13.0", + "tslib": "^2.1.0" }, "peerDependencies": { - "react": "^16.3.0" + "react": "^16.3.0 || 17 || 18", + "typescript": "^4.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, + "node_modules/react-intl/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -8738,9 +8820,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/scheduler": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz", - "integrity": "sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", + "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==", "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" @@ -8823,11 +8905,6 @@ "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" }, - "node_modules/shallow-equal": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/shallow-equal/-/shallow-equal-1.2.1.tgz", - "integrity": "sha512-S4vJDjHHMBaiZuT9NPb616CSmLf618jawtv3sufLl6ivK8WocjAo58cXwbRV1cgqxH0Qbv+iUt6m05eqEa2IRA==" - }, "node_modules/shallowequal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", @@ -9542,7 +9619,7 @@ "version": "5.3.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", - "dev": true, + "devOptional": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/package.json b/package.json index a7886ee..03d5817 100644 --- a/package.json +++ b/package.json @@ -27,11 +27,11 @@ "polished": "^4.0.5", "qs": "^6.9.4", "rc-upload": "^3.2.0", - "react": "^16.12.0", + "react": "^17", "react-cookie": "^4.0.3", - "react-dom": "^16.12.0", + "react-dom": "^17", "react-filepond": "^7.0.1", - "react-intl": "^3.12.0", + "react-intl": "^5", "react-redux": "^7.2.0", "react-resize-detector": "^4.2.1", "react-router-dom": "^5.1.2", @@ -78,10 +78,10 @@ "@types/classnames": "^2.2.9", "@types/jwt-decode": "^2.2.1", "@types/lodash-es": "^4.14.149", - "@types/node": "^18", + "@types/node": "^20", "@types/qs": "^6.9.5", - "@types/react": "^16", - "@types/react-dom": "^16", + "@types/react": "<18", + "@types/react-dom": "<18", "@types/react-filepond": "^5.0.5", "@types/react-redux": "^7.1.7", "@types/react-resize-detector": "^4.2.0", @@ -106,7 +106,8 @@ "vite-plugin-imp": "^2.4.0" }, "overrides": { - "@types/react": "^16", - "@types/react-dom": "^16" + "typescript": "^5.3", + "react": "^17", + "react-dom": "^17" } } diff --git a/src/index.tsx b/src/index.tsx index a3df136..e69c1d4 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,7 +1,7 @@ import { ConfigProvider } from 'antd'; import Bowser from 'bowser'; import 'pepjs'; // 指针事件垫片 -import React from 'react'; +import React, { StrictMode } from 'react'; import ReactDOM from 'react-dom'; import { IntlProvider } from 'react-intl'; // i18n import { Provider } from 'react-redux'; @@ -79,17 +79,19 @@ for (const hotKeyName in hotKeyInitialState) { } // 渲染 APP ReactDOM.render( - - - - - - - - - , + + + + + + + + + + + , document.getElementById('root'), ); From 01134b6af33b337a71782ce06dc5007a286fe984 Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Sun, 25 Feb 2024 19:51:08 +0900 Subject: [PATCH 2/9] update gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 77d54e2..8e4fa01 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ yarn-debug.log* yarn-error.log* .vscode/* +.idea +stats.html From 34d4775b58ffd5c53ad25a809160f1b1f4015dc1 Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Sun, 25 Feb 2024 21:08:36 +0900 Subject: [PATCH 3/9] api: make return type explicit --- src/apis/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/apis/index.ts b/src/apis/index.ts index 60438ff..788d7ad 100644 --- a/src/apis/index.ts +++ b/src/apis/index.ts @@ -125,7 +125,9 @@ export type FailureResults = | CancelFailureResult | OtherFailureResult; -export const request = (axiosConfig: AxiosRequestConfig) => { +export const request = ( + axiosConfig: AxiosRequestConfig, +): Promise> => { return instance({ // param=value1¶m=value2,去除 query 中数组的 [] 结尾 paramsSerializer: function (params) { From 840b39e338c6922571639c571cd26f55e33f4334 Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Sun, 25 Feb 2024 20:02:24 +0900 Subject: [PATCH 4/9] vite: enable sourcemap --- vite.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/vite.config.ts b/vite.config.ts index f8fe5cb..3ff4060 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -16,6 +16,7 @@ const backendOrigin = 'http://localhost:13080'; export default defineConfig({ // root: 'src', build: { + sourcemap: true, outDir: path.join(__dirname, './build'), emptyOutDir: true, rollupOptions: { From d43f3a92ed0145c920ce11815585aa99e7587ed5 Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Sun, 25 Feb 2024 20:12:22 +0900 Subject: [PATCH 5/9] add not found page --- src/App.tsx | 4 ++++ src/hooks/useTitle.ts | 3 ++- src/pages/404.tsx | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/pages/404.tsx diff --git a/src/App.tsx b/src/App.tsx index 578a6d1..33fbb6d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -9,6 +9,7 @@ import Index from './pages/Index'; import Login from './pages/Login'; import Register from './pages/Register'; import ResetPassword from './pages/ResetPassword'; +import { NotFoundPage } from './pages/404'; import { AppState } from './store'; import style from './style'; @@ -164,6 +165,9 @@ const App: React.FC = () => { )} + + + )} diff --git a/src/hooks/useTitle.ts b/src/hooks/useTitle.ts index 080e0e1..393bbdf 100644 --- a/src/hooks/useTitle.ts +++ b/src/hooks/useTitle.ts @@ -14,11 +14,12 @@ interface UseTitle { * @param prefix 前缀 * @param suffix 后缀 * @param hyphen 站点名和前缀/后缀之间的连字符 + * @param deps */ export const useTitle: UseTitle = ( { prefix = '', suffix = '', hyphen = ' · ' }: UseTitleParams = {}, deps = [], -) => { +): void => { const { formatMessage } = useIntl(); if (prefix !== '') prefix = prefix + hyphen; if (suffix !== '') suffix = hyphen + suffix; diff --git a/src/pages/404.tsx b/src/pages/404.tsx new file mode 100644 index 0000000..256caff --- /dev/null +++ b/src/pages/404.tsx @@ -0,0 +1,20 @@ +import { useTitle } from '../hooks'; +import { useHistory } from 'react-router-dom'; +import { FC, useEffect } from 'react'; + +export const NotFoundPage: FC<{}> = (props) => { + const history = useHistory(); + useTitle({ + prefix: 'Page not found', + }); + useEffect(() => { + const timer = setTimeout(() => { + history.push('/'); + }, 3000); + + return () => { + clearTimeout(timer); + }; + }, []); + return
Page not found. You will be redirected shortly
; +}; From 941cd504f0caa6462d617ab42dbb744f1198723e Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Sun, 25 Feb 2024 20:12:28 +0900 Subject: [PATCH 6/9] make tsc happy --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index af10394..d59fb3a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,7 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react" + "jsx": "react-jsx" }, "include": ["src"] } From f26693181f40190905beb22d9af38a86e73de385 Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Sun, 25 Feb 2024 21:08:14 +0900 Subject: [PATCH 7/9] fix typo --- src/components/Button.tsx | 10 +++++----- src/components/Output.tsx | 2 +- src/components/TeamInsightProjectList.tsx | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/Button.tsx b/src/components/Button.tsx index dda132e..4550d5e 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -13,7 +13,7 @@ import { Tooltip, TooltipProps } from './Tooltip'; interface ButtonProps { tooltipProps?: TooltipProps; loading?: boolean; - disibled?: boolean; + disabled?: boolean; type?: 'button' | 'link'; linkProps?: React.DetailedHTMLProps< React.AnchorHTMLAttributes, @@ -38,7 +38,7 @@ export const Button: FC = ({ color = style.primaryColor, colorDisibled = style.primaryColorLightest, loading = false, - disibled = false, + disabled = false, onClick, className, children, @@ -73,7 +73,7 @@ export const Button: FC = ({ return (
= ({ color: ${color}; margin-right: 10px; } - ${disibled || loading || clickEffect()} + ${disabled || loading || clickEffect()} &.Button--disibled { cursor: not-allowed; user-select: none; @@ -120,7 +120,7 @@ export const Button: FC = ({ } } `} - onClick={disibled || loading ? undefined : onClick} + onClick={disabled || loading ? undefined : onClick} > {tooltipProps ? ( {buttonContent} diff --git a/src/components/Output.tsx b/src/components/Output.tsx index 3308032..acdbc20 100644 --- a/src/components/Output.tsx +++ b/src/components/Output.tsx @@ -86,7 +86,7 @@ export const Output: FC = ({ index, output, className }) => {