Skip to content

Commit 2038d37

Browse files
committed
Move browser upgrade page
- add modernizr - config modernizr - add in tests and initial banner logic
1 parent 7ed4d0c commit 2038d37

File tree

8 files changed

+249
-5
lines changed

8 files changed

+249
-5
lines changed

package-lock.json

Lines changed: 205 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
],
77
"scripts": {
88
"build": "cd packages/react-scripts && node bin/react-scripts.js build",
9+
"pre:build": "cd packages/react-scripts && npm run modernizr",
910
"changelog": "lerna-changelog",
1011
"create-react-app": "node tasks/cra.js",
1112
"e2e": "tasks/e2e-simple.sh",

packages/react-scripts/.nvmrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
16
1+
20
2+
// todo revert this, only done to npm link

packages/react-scripts/layout/views/layout.ejs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
<% if (process.env.NODE_ENV === 'production') { %>
3131
<% include partials/dynatrace %>
3232
<% } %>
33+
34+
<script>
35+
<% include ../../modernizr.js %>
36+
</script>
37+
3338
<script>
3439
window.SERVER_DATA = {};
3540
<%- typeof cacheKey !== 'undefined' ? `SERVER_DATA.cacheKey = '${cacheKey}';` : ''; %>
@@ -50,6 +55,12 @@
5055
</script>
5156
</head>
5257
<body>
58+
<header id="outdated-browser" style="display: none">
59+
<p>Your browser is outdated. Please consider upgrading to a modern browser for a better experience.</p>
60+
</header>
5361
<%- body %>
62+
<script>
63+
<% include partials/featureDetection %>
64+
</script>
5465
</body>
5566
</html>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const header = document.getElementById('outdated-browser');
2+
3+
console.log('Checking for outdated browser message', Modernizr);
4+
5+
const outdatedFeatures = Object.keys(Modernizr).filter(feature => !Modernizr[feature]);
6+
7+
if (outdatedFeatures.length > 0 && header) {
8+
header.style.display = 'block';
9+
console.log('Outdated browser message displayed:', outdatedFeatures);
10+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"minify": true,
3+
"options": [
4+
"addTest"
5+
],
6+
"feature-detects": [
7+
"test/es6/promises",
8+
"test/network/fetch",
9+
"test/url/parser",
10+
"test/dom/intersection-observer"
11+
]
12+
}

packages/react-scripts/modernizr.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-scripts/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
},
1818
"scripts": {
1919
"prettier": "npx prettier --arrow-parens always --single-quote --trailing-comma es5 --print-width 120 --no-semi --write \"template*/**/*.js\"",
20-
"fs-publish": "npmPublish"
20+
"fs-publish": "npmPublish",
21+
"modernizr": "modernizr -c modernizr-config.json"
2122
},
2223
"files": [
2324
"bin",
@@ -124,6 +125,7 @@
124125
"babel-plugin-react-docgen": "^3.0.0",
125126
"graphql-tag": "^2.12.6",
126127
"i18next": "19.8.7",
128+
"modernizr": "^3.13.0",
127129
"react": "^18.0.0",
128130
"react-dom": "^18.0.0",
129131
"react-i18next": "^11.0.1",
@@ -134,9 +136,9 @@
134136
"fsevents": "^2.3.2"
135137
},
136138
"peerDependencies": {
139+
"@fs/eslint-config-frontier-react": ">=10.0.0",
137140
"react": ">= 16",
138-
"typescript": "^3.2.1 || ^4 || ^5",
139-
"@fs/eslint-config-frontier-react": ">=10.0.0"
141+
"typescript": "^3.2.1 || ^4 || ^5"
140142
},
141143
"peerDependenciesMeta": {
142144
"typescript": {

0 commit comments

Comments
 (0)