From 1b5d856a2136bfa30a0e858e25ab390571785ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Tue, 23 Apr 2019 21:29:08 +0100 Subject: [PATCH 1/4] refactor(ui): use react-app-polyfill instead of @babel/polyfill CRA 3.0 depracates babel/polyfill, react-app-polyfill is the new recommended pollyfill package. Remove IE from the list of supported browsers and drop polyfills for it since doesn't work anyway - Proxy support in ES is required for mobx 5.x and that cannot be polyfilled. --- ui/package.json | 3 +-- ui/src/index.js | 4 ++-- ui/yarn.lock | 12 ++---------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/ui/package.json b/ui/package.json index d8afad5e4..587558400 100644 --- a/ui/package.json +++ b/ui/package.json @@ -5,7 +5,6 @@ "private": true, "dependencies": { "@attently/riek": "2.0.1", - "@babel/polyfill": "7.4.3", "@fortawesome/fontawesome-svg-core": "1.2.17", "@fortawesome/free-regular-svg-icons": "5.8.1", "@fortawesome/free-solid-svg-icons": "5.8.1", @@ -31,6 +30,7 @@ "prop-types": "15.7.2", "qs": "6.7.0", "react": "16.8.6", + "react-app-polyfill": "1.0.0", "react-autosuggest": "9.4.3", "react-datepicker": "2.4.0", "react-dom": "16.8.6", @@ -76,7 +76,6 @@ "Chrome >= 45", "Firefox >= 38", "Edge >= 12", - "Explorer >= 10", "iOS >= 9", "Safari >= 9", "Android >= 4.4", diff --git a/ui/src/index.js b/ui/src/index.js index c879aebce..11202bdde 100644 --- a/ui/src/index.js +++ b/ui/src/index.js @@ -1,6 +1,6 @@ // MUST be first thing we import -// https://babeljs.io/docs/en/babel-polyfill#usage-in-node-browserify-webpack -import "@babel/polyfill"; +// https://github.com/facebook/create-react-app/blob/master/packages/react-app-polyfill/README.md +import "react-app-polyfill/stable"; // fetch() polyfill for IE and some mobile browsers import "whatwg-fetch"; diff --git a/ui/yarn.lock b/ui/yarn.lock index 0d071211c..e80306e4a 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -677,14 +677,6 @@ "@babel/helper-regex" "^7.4.3" regexpu-core "^4.5.4" -"@babel/polyfill@7.4.3": - version "7.4.3" - resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.4.3.tgz#332dc6f57b718017c3a8b37b4eea8aa6eeac1187" - integrity sha512-rkv8WIvJshA5Ev8iNMGgz5WZkRtgtiPexiT7w5qevGTuT7ZBfM3de9ox1y9JR5/OXb/sWGBbWlHNa7vQKqku3Q== - dependencies: - core-js "^2.6.5" - regenerator-runtime "^0.13.2" - "@babel/preset-env@7.4.3", "@babel/preset-env@^7.1.6": version "7.4.3" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.4.3.tgz#e71e16e123dc0fbf65a52cbcbcefd072fbd02880" @@ -3108,7 +3100,7 @@ core-js@^1.0.0: resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY= -core-js@^2.4.0, core-js@^2.5.0, core-js@^2.6.5: +core-js@^2.4.0, core-js@^2.5.0: version "2.6.5" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895" integrity sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A== @@ -9161,7 +9153,7 @@ rc@^1.2.7, rc@~1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -react-app-polyfill@^1.0.0: +react-app-polyfill@1.0.0, react-app-polyfill@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/react-app-polyfill/-/react-app-polyfill-1.0.0.tgz#735c725c1d4261b710cb200c498789c8b80e0f74" integrity sha512-fbZxEZdfx+rVENMvGTFjUcDDOZGKHaiavA8Y+FwM2I/o8gJT6pCYZk19XfeOntVzGZH2F1qqH7SLjXMhUM+YJw== From 5075f5bcf65c424db6fab42d5874661ce9b1d912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Tue, 23 Apr 2019 21:31:56 +0100 Subject: [PATCH 2/4] refactor(ui): use jsconfig.json instead of .env file Setting NODE_PATH via env is depracated in RCA 3.0 --- assets_test.go | 4 ++-- ui/.env | 1 - ui/jsconfig.json | 6 ++++++ 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 ui/jsconfig.json diff --git a/assets_test.go b/assets_test.go index 9110b7944..bf7e28b6f 100644 --- a/assets_test.go +++ b/assets_test.go @@ -48,14 +48,14 @@ func TestCustomizationAssets(t *testing.T) { customJS: "ui/.env", path: "/custom.js", code: 200, - body: "NODE_PATH=src\nPUBLIC_URL=.\n", + body: "PUBLIC_URL=.\n", mime: "text/plain; charset=utf-8", }, { customCSS: "ui/.env", path: "/custom.css", code: 200, - body: "NODE_PATH=src\nPUBLIC_URL=.\n", + body: "PUBLIC_URL=.\n", mime: "text/plain; charset=utf-8", }, } diff --git a/ui/.env b/ui/.env index 816df054f..66c5b8bc6 100644 --- a/ui/.env +++ b/ui/.env @@ -1,2 +1 @@ -NODE_PATH=src PUBLIC_URL=. diff --git a/ui/jsconfig.json b/ui/jsconfig.json new file mode 100644 index 000000000..5875dc5b6 --- /dev/null +++ b/ui/jsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "baseUrl": "src" + }, + "include": ["src"] +} From a93c6b254ce3ec856ccf8495b231f92b9a8d4cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Tue, 23 Apr 2019 22:01:11 +0100 Subject: [PATCH 3/4] fix(ui): drop whatwg-fetch import as it's included in react-app-polyfill --- ui/package.json | 3 +-- ui/src/index.js | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/ui/package.json b/ui/package.json index 587558400..cfb01a13b 100644 --- a/ui/package.json +++ b/ui/package.json @@ -50,8 +50,7 @@ "react-tippy": "1.2.3", "react-transition-group": "4.0.0", "react-truncate": "2.4.0", - "semver": "6.0.0", - "whatwg-fetch": "3.0.0" + "semver": "6.0.0" }, "scripts": { "start": "NODE_ENV=dev REACT_APP_BACKEND_URI=http://localhost:8080 react-scripts start", diff --git a/ui/src/index.js b/ui/src/index.js index 11202bdde..ce468eb79 100644 --- a/ui/src/index.js +++ b/ui/src/index.js @@ -2,9 +2,6 @@ // https://github.com/facebook/create-react-app/blob/master/packages/react-app-polyfill/README.md import "react-app-polyfill/stable"; -// fetch() polyfill for IE and some mobile browsers -import "whatwg-fetch"; - import React from "react"; import ReactDOM from "react-dom"; From 1220867d0749fdf106dc9b6fdfc5d5b1cc753bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Wed, 24 Apr 2019 21:35:17 +0100 Subject: [PATCH 4/4] fix(ui): update browser list Drop browsers that don't support Proxy objects --- ui/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/package.json b/ui/package.json index cfb01a13b..2ec7a535a 100644 --- a/ui/package.json +++ b/ui/package.json @@ -72,12 +72,12 @@ ">= 1%", "last 1 major version", "not dead", - "Chrome >= 45", + "Chrome >= 49", "Firefox >= 38", "Edge >= 12", "iOS >= 9", - "Safari >= 9", + "Safari >= 10", "Android >= 4.4", - "Opera >= 30" + "Opera >= 36" ] }