Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit f0ca990

Browse files
feat: update to CRA4 and React 17
Update to use latest versions from create-react-app and react. It also contains a refactor, cleaning unneeded React references. Also, as a small addition, I have removed the numeric zoom label from ZoomControl in skeleton template (as in sample-app) Co-authored-by: VictorVelarde <victor.velarde@gmail.com>
1 parent ab3a5cc commit f0ca990

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+162
-493
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ template-skeleton/README.md
66
/template-skeleton/template/yarn.lock
77
/template-skeleton/template/node_modules
88
/template-skeleton/template/_templates
9+
/template-skeleton/template/.eslintcache
910

1011
template-sample-app/README.md
1112
/template-sample-app/yarn.lock
1213
/template-sample-app/template/package.json
1314
/template-sample-app/template/yarn.lock
1415
/template-sample-app/template/node_modules
1516
/template-sample-app/template/_templates
17+
/template-sample-app/template/.eslintcache
1618

1719
# dependencies
1820
node_modules

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- Refactor source structure for simplification [#164](https://github.com/CartoDB/carto-react-template/issues/164)
1010
- Add basic e2e tests to both sample-app and skeleton with cypress [#169](https://github.com/CartoDB/carto-react-template/pull/169)
1111
- Update deck.gl version to 8.4 [#184](https://github.com/CartoDB/carto-react-template/pull/184)
12+
- Update to CRA4 and React 17 [#186](https://github.com/CartoDB/carto-react-template/pull/186)
1213

1314
## 1.0.0-beta10 (2021-01-16)
1415
- Fix missing babel dependencies when using CRA for both templates [#160](https://github.com/CartoDB/carto-react-template/issues/160)

template-sample-app/template.json

Lines changed: 31 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,53 @@
11
{
22
"package": {
33
"dependencies": {
4-
"@babel/helper-builder-react-jsx": "^7.10.4",
5-
"@babel/plugin-transform-react-jsx": "^7.12.12",
6-
"@carto/react": "^1.0.0-beta12",
7-
"@formatjs/intl-getcanonicallocales": "^1.5.2",
8-
"@formatjs/intl-locale": "^2.4.8",
9-
"@formatjs/intl-numberformat": "^6.0.0",
10-
"@formatjs/intl-pluralrules": "^4.0.0",
11-
"@material-ui/core": "^4.11.0",
12-
"@material-ui/icons": "^4.9.1",
13-
"@material-ui/lab": "^4.0.0-alpha.56",
4+
"@carto/react": "1.0.0-beta12",
5+
"@formatjs/intl-getcanonicallocales": "^1.5.3",
6+
"@formatjs/intl-locale": "^2.4.14",
7+
"@formatjs/intl-numberformat": "^6.1.4",
8+
"@formatjs/intl-pluralrules": "^4.0.6",
9+
"@material-ui/core": "^4.11.3",
10+
"@material-ui/icons": "^4.11.2",
11+
"@material-ui/lab": "4.0.0-alpha.57",
1412
"@reduxjs/toolkit": "^1.5.0",
1513
"@testing-library/cypress": "^7.0.3",
16-
"@testing-library/jest-dom": "^4.2.4",
17-
"@testing-library/react": "^9.3.2",
18-
"@testing-library/user-event": "^7.1.2",
14+
"@testing-library/jest-dom": "^5.11.9",
15+
"@testing-library/react": "^11.2.3",
16+
"@testing-library/user-event": "^12.6.2",
1917
"cypress": "^6.3.0",
2018
"deck.gl": "^8.4.0",
2119
"echarts": "^4.9.0",
2220
"echarts-for-react": "^2.0.16",
21+
"eslint-config-prettier": "^7.2.0",
22+
"eslint-plugin-prettier": "^3.3.1",
23+
"firebase-tools": "^9.2.2",
2324
"history": "^5.0.0",
24-
"react": "^16.13.1",
25+
"husky": "^4.3.8",
26+
"hygen": "^6.0.4",
27+
"lint-staged": "^10.5.3",
28+
"prettier": "^2.2.1",
29+
"react": "^17.0.1",
2530
"react-app-polyfill": "^2.0.0",
26-
"react-dom": "^16.13.1",
27-
"react-map-gl": "^5.2.8",
28-
"react-redux": "^7.1.3",
31+
"react-app-rewired": "^2.1.8",
32+
"react-dom": "^17.0.1",
33+
"react-is": "^17.0.1",
34+
"react-map-gl": "^5.3.0",
35+
"react-redux": "^7.2.2",
2936
"react-router-dom": "^6.0.0-beta.0",
30-
"react-scripts": "3.4.3",
31-
"eslint-config-prettier": "^6.12.0",
32-
"eslint-loader": "^4.0.2",
33-
"eslint-plugin-prettier": "^3.1.4",
34-
"eslint-plugin-react": "^7.21.2",
35-
"husky": "^4.3.0",
36-
"lint-staged": "^10.4.0",
37-
"prettier": "^2.1.2",
38-
"react-app-rewired": "^2.1.6",
39-
"hygen": "^6.0.4"
37+
"react-scripts": "4.0.1"
4038
},
4139
"scripts": {
4240
"lint": "eslint './src/**/*.{js,jsx}'",
4341
"lint:fix": "eslint './src/**/*.{js,jsx}' --fix",
44-
"format": "npx prettier --write \"**/*.+(js|jsx|json|css|md)\"",
42+
"format": "prettier --write \"**/*.+(js|jsx|json|css|md)\" --ignore-path .gitignore",
4543
"hygen": "hygen",
4644
"updateSupportedBrowsers": "echo \"var browserRegex = $(npx browserslist-useragent-regexp --allowHigherVersions);\" > public/supportedBrowsers.js"
4745
},
4846
"eslintConfig": {
49-
"extends": "react-app"
47+
"extends": ["react-app", "prettier", "prettier/react"]
5048
},
5149
"browserslist": {
52-
"production": [
53-
">0.2%",
54-
"not dead",
55-
"not op_mini all",
56-
"not explorer 11"
57-
],
50+
"production": [">0.2%", "not dead", "not op_mini all", "not explorer 11"],
5851
"development": [
5952
"last 1 chrome version",
6053
"last 1 firefox version",
@@ -67,14 +60,8 @@
6760
}
6861
},
6962
"lint-staged": {
70-
"*.+(js|jsx)": [
71-
"yarn lint:fix",
72-
"git add"
73-
],
74-
"*.+(js|jsx|json|css|md)": [
75-
"prettier --write",
76-
"git add"
77-
]
63+
"*.+(js|jsx)": ["yarn lint:fix", "git add"],
64+
"*.+(js|jsx|json|css|md)": ["prettier --write", "git add"]
7865
}
7966
}
80-
}
67+
}

template-sample-app/template/gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package.dev.json
44
config-overrides.js
55
storybook-static
6+
.eslintcache
67

78
# dependencies
89
/node_modules

template-sample-app/template/package.dev.json

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,41 @@
33
"version": "1.0.0-beta12",
44
"private": true,
55
"dependencies": {
6-
"@carto/react": "^1.0.0-beta12",
7-
"@formatjs/intl-getcanonicallocales": "^1.5.2",
8-
"@formatjs/intl-locale": "^2.4.8",
9-
"@formatjs/intl-numberformat": "^6.0.0",
10-
"@formatjs/intl-pluralrules": "^4.0.0",
11-
"@material-ui/core": "^4.11.0",
12-
"@material-ui/icons": "^4.9.1",
13-
"@material-ui/lab": "^4.0.0-alpha.56",
6+
"@carto/react": "1.0.0-beta12",
7+
"@formatjs/intl-getcanonicallocales": "^1.5.3",
8+
"@formatjs/intl-locale": "^2.4.14",
9+
"@formatjs/intl-numberformat": "^6.1.4",
10+
"@formatjs/intl-pluralrules": "^4.0.6",
11+
"@material-ui/core": "^4.11.3",
12+
"@material-ui/icons": "^4.11.2",
13+
"@material-ui/lab": "4.0.0-alpha.57",
1414
"@reduxjs/toolkit": "^1.5.0",
1515
"@testing-library/cypress": "^7.0.3",
16-
"@testing-library/jest-dom": "^4.2.4",
17-
"@testing-library/react": "^9.3.2",
18-
"@testing-library/user-event": "^7.1.2",
16+
"@testing-library/jest-dom": "^5.11.9",
17+
"@testing-library/react": "^11.2.3",
18+
"@testing-library/user-event": "^12.6.2",
1919
"cypress": "^6.3.0",
2020
"deck.gl": "^8.4.0",
2121
"echarts": "^4.9.0",
2222
"echarts-for-react": "^2.0.16",
2323
"history": "^5.0.0",
24-
"react": "^16.13.1",
24+
"react": "^17.0.1",
2525
"react-app-polyfill": "^2.0.0",
26-
"react-dom": "^16.13.1",
27-
"react-map-gl": "^5.2.8",
28-
"react-redux": "^7.1.3",
26+
"react-dom": "^17.0.1",
27+
"react-map-gl": "^5.3.0",
28+
"react-redux": "^7.2.2",
2929
"react-router-dom": "^6.0.0-beta.0",
30-
"react-scripts": "3.4.3"
30+
"react-scripts": "4.0.1"
3131
},
3232
"devDependencies": {
33-
"@babel/core": "^7.12.3",
34-
"babel-loader": "8.1.0",
35-
"eslint-config-prettier": "^6.12.0",
36-
"eslint-loader": "^4.0.2",
37-
"eslint-plugin-prettier": "^3.1.4",
38-
"eslint-plugin-react": "^7.21.2",
39-
"firebase-tools": "^8.16.2",
40-
"husky": "^4.3.0",
33+
"eslint-config-prettier": "^7.2.0",
34+
"eslint-plugin-prettier": "^3.3.1",
35+
"firebase-tools": "^9.2.2",
36+
"husky": "^4.3.8",
4137
"hygen": "^6.0.4",
42-
"lint-staged": "^10.4.0",
43-
"prettier": "^2.1.2",
44-
"react-app-rewired": "^2.1.6",
38+
"lint-staged": "^10.5.3",
39+
"prettier": "^2.2.1",
40+
"react-app-rewired": "^2.1.8",
4541
"react-is": "^17.0.1"
4642
},
4743
"scripts": {
@@ -52,12 +48,12 @@
5248
"eject": "react-scripts eject",
5349
"lint": "eslint './src/**/*.{js,jsx}'",
5450
"lint:fix": "eslint './src/**/*.{js,jsx}' --fix",
55-
"format": "npx prettier --write \"**/*.+(js|jsx|json|css|md)\"",
51+
"format": "prettier --write \"**/*.+(js|jsx|json|css|md)\" --ignore-path .gitignore",
5652
"hygen": "hygen",
5753
"updateSupportedBrowsers": "echo \"var browserRegex = $(npx browserslist-useragent-regexp --allowHigherVersions);\" > public/supportedBrowsers.js"
5854
},
5955
"eslintConfig": {
60-
"extends": "react-app"
56+
"extends": ["react-app", "prettier", "prettier/react"]
6157
},
6258
"browserslist": {
6359
"production": [">0.2%", "not dead", "not op_mini all", "not explorer 11"],
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# https://www.robotstxt.org/robotstxt.html
2-
User-agent: *
1+
# https://www.robotstxt.org/robotstxt.html
2+
User-agent: *
3+
Disallow:

template-sample-app/template/src/App.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react';
21
import { useSelector } from 'react-redux';
32
import { useRoutes } from 'react-router-dom';
43

template-sample-app/template/src/components/common/Header.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useState } from 'react';
1+
import { useEffect, useState } from 'react';
22
import {
33
AppBar,
44
Drawer,
@@ -61,7 +61,7 @@ const NavigationMenu = (props) => {
6161
const classes = useStyles();
6262

6363
return (
64-
<React.Fragment>
64+
<>
6565
<Grid
6666
container
6767
direction={vertical ? 'column' : 'row'}
@@ -79,7 +79,7 @@ const NavigationMenu = (props) => {
7979
{/* Auto import links */}
8080
</Tabs>
8181
</Grid>
82-
</React.Fragment>
82+
</>
8383
);
8484
};
8585

template-sample-app/template/src/components/common/Isochrone.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useEffect, useState } from 'react';
1+
import { useCallback, useEffect, useState } from 'react';
22

33
import {
44
Button,

template-sample-app/template/src/components/common/Map.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react';
21
import { useSelector, useDispatch } from 'react-redux';
32
import DeckGL from '@deck.gl/react';
43
import 'mapbox-gl/dist/mapbox-gl.css';

0 commit comments

Comments
 (0)