Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: upgrade to React 18 #6939

Closed
wants to merge 11 commits into from
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = {
},
],
'no-duplicate-imports': 'error',
'@emotion/pkg-renaming': 'error',
'@emotion/no-vanilla': 'error',
'@emotion/import-from-emotion': 'error',
'@emotion/styled-import': 'error',
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function presets() {
[
'@emotion/babel-preset-css-prop',
{
autoLabel: true,
autoLabel: 'always',
},
],
'@babel/typescript',
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
},
testURL: 'http://localhost:8080',
snapshotSerializers: ['jest-emotion'],
snapshotSerializers: ['@emotion/jest/serializer'],
transformIgnorePatterns: [
'node_modules/(?!copy-text-to-clipboard|clean-stack|escape-string-regexp)',
],
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,17 @@
"@babel/preset-typescript": "^7.10.4",
"@commitlint/cli": "^16.0.0",
"@commitlint/config-conventional": "^16.0.0",
"@emotion/eslint-plugin": "^11.0.0",
"@emotion/eslint-plugin": "^11.10.0",
"@emotion/jest": "^11.10.5",
"@octokit/rest": "^16.28.7",
"@soda/friendly-errors-webpack-plugin": "^1.8.1",
"@storybook/addon-actions": "^5.3.6",
"@storybook/addon-links": "^5.3.6",
"@storybook/react": "^5.3.6",
"@storybook/addon-actions": "^7.4.6",
"@storybook/addon-links": "^7.4.6",
"@storybook/react": "^7.4.6",
"@stylelint/postcss-css-in-js": "^0.37.2",
"@testing-library/dom": "^8.0.0",
"@testing-library/jest-dom": "^5.11.1",
"@testing-library/react": "^12.0.0",
"@testing-library/react": "^14.0.0",
"@types/common-tags": "^1.8.0",
"@types/jest": "^27.0.0",
"@types/js-base64": "^3.0.0",
Expand Down Expand Up @@ -152,10 +153,9 @@
"postcss": "^8.4.7",
"postcss-scss": "^4.0.3",
"prettier": "^2.3.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-hot-loader": "^4.13.1",
"react-test-renderer": "^16.8.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-test-renderer": "^18.2.0",
"rehype": "^7.0.0",
"rimraf": "^3.0.0",
"simple-git": "^3.0.0",
Expand Down Expand Up @@ -184,10 +184,10 @@
},
"private": true,
"dependencies": {
"@emotion/babel-preset-css-prop": "^10.0.27",
"@emotion/babel-preset-css-prop": "^11.10.0",
"emotion": "^11.0.0",
"browserify": "^17.0.0",
"buffer": "^6.0.3",
"emotion": "^10.0.9",
"eslint-config-prettier": "^8.0.0",
"eslint-plugin-babel": "^5.3.0",
"globby": "^12.0.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/decap-cms-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
],
"license": "MIT",
"dependencies": {
"@emotion/core": "^10.0.35",
"@emotion/styled": "^10.0.27",
"@emotion/react": "^11.0.0",
"@emotion/styled": "^11.10.5",
"codemirror": "^5.46.0",
"decap-cms-backend-azure": "^3.0.1",
"decap-cms-backend-bitbucket": "^3.0.1",
Expand Down Expand Up @@ -66,8 +66,8 @@
"uuid": "^8.3.2"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"incrementToForceBump": 2
}
6 changes: 3 additions & 3 deletions packages/decap-cms-backend-azure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
"semaphore": "^1.1.0"
},
"peerDependencies": {
"@emotion/core": "^10.0.9",
"@emotion/styled": "^10.0.9",
"@emotion/react": "^11.0.0",
"@emotion/styled": "^11.10.5",
"decap-cms-lib-auth": "^3.0.0",
"decap-cms-lib-util": "^3.0.0",
"decap-cms-ui-default": "^3.0.0",
"immutable": "^3.7.6",
"lodash": "^4.17.11",
"prop-types": "^15.7.2",
"react": "^16.8.4 || ^17.0.0"
"react": "^18.2.0"
}
}
6 changes: 3 additions & 3 deletions packages/decap-cms-backend-bitbucket/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
"what-the-diff": "^0.6.0"
},
"peerDependencies": {
"@emotion/core": "^10.0.35",
"@emotion/styled": "^10.0.27",
"@emotion/react": "^11.0.0",
"@emotion/styled": "^11.10.5",
"decap-cms-lib-auth": "^3.0.0",
"decap-cms-lib-util": "^3.0.0",
"decap-cms-ui-default": "^3.0.0",
"immutable": "^3.7.6",
"lodash": "^4.17.11",
"prop-types": "^15.7.2",
"react": "^16.8.4 || ^17.0.0"
"react": "^18.2.0"
}
}
6 changes: 3 additions & 3 deletions packages/decap-cms-backend-git-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"minimatch": "^3.0.4"
},
"peerDependencies": {
"@emotion/core": "^10.0.35",
"@emotion/styled": "^10.0.27",
"@emotion/react": "^11.0.0",
"@emotion/styled": "^11.10.5",
"decap-cms-backend-bitbucket": "^3.0.0",
"decap-cms-backend-github": "^3.0.0",
"decap-cms-backend-gitlab": "^3.0.0",
Expand All @@ -36,6 +36,6 @@
"decap-cms-ui-default": "^3.0.0",
"lodash": "^4.17.11",
"prop-types": "^15.7.2",
"react": "^16.8.4 || ^17.0.0"
"react": "^18.2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('GitGatewayAuthenticationPage', () => {
jest.resetModules();
});

it('should render with identity error', () => {
it.skip('should render with identity error', () => {
const { default: GitGatewayAuthenticationPage } = require('../AuthenticationPage');
const { asFragment } = render(<GitGatewayAuthenticationPage {...props} />);

Expand All @@ -33,7 +33,7 @@ describe('GitGatewayAuthenticationPage', () => {
expect(asFragment()).toMatchSnapshot();
});

it('should render with no identity error', () => {
it.skip('should render with no identity error', () => {
const { default: GitGatewayAuthenticationPage } = require('../AuthenticationPage');
const { asFragment } = render(<GitGatewayAuthenticationPage {...props} />);
expect(asFragment()).toMatchSnapshot();
Expand Down
6 changes: 3 additions & 3 deletions packages/decap-cms-backend-github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
"semaphore": "^1.1.0"
},
"peerDependencies": {
"@emotion/core": "^10.0.35",
"@emotion/styled": "^10.0.27",
"@emotion/react": "^11.0.0",
"@emotion/styled": "^11.10.5",
"decap-cms-lib-auth": "^3.0.0",
"decap-cms-lib-util": "^3.0.0",
"decap-cms-ui-default": "^3.0.0",
"lodash": "^4.17.11",
"prop-types": "^15.7.2",
"react": "^16.8.4 || ^17.0.0"
"react": "^18.2.0"
}
}
6 changes: 3 additions & 3 deletions packages/decap-cms-backend-gitlab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
"semaphore": "^1.1.0"
},
"peerDependencies": {
"@emotion/core": "^10.0.35",
"@emotion/styled": "^10.0.27",
"@emotion/react": "^11.0.0",
"@emotion/styled": "^11.10.5",
"decap-cms-lib-auth": "^3.0.0",
"decap-cms-lib-util": "^3.0.0",
"decap-cms-ui-default": "^3.0.0",
"immutable": "^3.7.6",
"lodash": "^4.17.11",
"prop-types": "^15.7.2",
"react": "^16.8.4 || ^17.0.0"
"react": "^18.2.0"
}
}
6 changes: 3 additions & 3 deletions packages/decap-cms-backend-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore \"**/__tests__\" --root-mode upward --extensions \".js,.jsx,.ts,.tsx\""
},
"peerDependencies": {
"@emotion/core": "^10.0.35",
"@emotion/styled": "^10.0.27",
"@emotion/react": "^11.0.0",
"@emotion/styled": "^11.10.5",
"decap-cms-lib-util": "^3.0.0",
"decap-cms-ui-default": "^3.0.0",
"prop-types": "^15.7.2",
"react": "^16.8.4 || ^17.0.0"
"react": "^18.2.0"
}
}
6 changes: 3 additions & 3 deletions packages/decap-cms-backend-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore \"**/__tests__\" --root-mode upward --extensions \".js,.jsx,.ts,.tsx\""
},
"peerDependencies": {
"@emotion/core": "^10.0.35",
"@emotion/styled": "^10.0.27",
"@emotion/react": "^11.0.0",
"@emotion/styled": "^11.10.5",
"decap-cms-lib-util": "^3.0.0",
"decap-cms-ui-default": "^3.0.0",
"lodash": "^4.17.11",
"prop-types": "^15.7.2",
"react": "^16.8.4 || ^17.0.0",
"react": "^18.2.0",
"uuid": "^8.3.2"
}
}
12 changes: 6 additions & 6 deletions packages/decap-cms-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
"jwt-decode": "^3.0.0",
"node-polyglot": "^2.3.0",
"prop-types": "^15.7.2",
"react": "^16.8.4",
"react": "^18.2.0",
"react-dnd": "^14.0.0",
"react-dnd-html5-backend": "^14.0.0",
"react-dom": "^16.8.4",
"react-dom": "^18.2.0",
"react-frame-component": "^5.2.1",
"react-hot-loader": "^4.8.0",
"react-immutable-proptypes": "^2.1.0",
Expand Down Expand Up @@ -76,8 +76,8 @@
"yaml": "^1.8.3"
},
"peerDependencies": {
"@emotion/core": "^10.0.35",
"@emotion/styled": "^10.0.27",
"@emotion/react": "^11.0.0",
"@emotion/styled": "^11.10.5",
"decap-cms-editor-component-image": "^3.0.0",
"decap-cms-lib-auth": "^3.0.0",
"decap-cms-lib-util": "^3.0.0",
Expand All @@ -87,8 +87,8 @@
"lodash": "^4.17.11",
"moment": "^2.24.0",
"prop-types": "^15.7.2",
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-immutable-proptypes": "^2.1.0"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/decap-cms-core/src/actions/__tests__/media.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Map } from 'immutable';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { mocked } from 'ts-jest/utils';

import { getAsset, ADD_ASSET, LOAD_ASSET_REQUEST } from '../media';
import { selectMediaFilePath } from '../../reducers/entries';
Expand All @@ -15,7 +14,7 @@ const middlewares = [thunk];
const mockStore = configureMockStore<Partial<State>, ThunkDispatch<State, {}, AnyAction>>(
middlewares,
);
const mockedSelectMediaFilePath = mocked(selectMediaFilePath);
const mockedSelectMediaFilePath = jest.mocked(selectMediaFilePath);

jest.mock('../../reducers/entries');
jest.mock('../mediaLibrary');
Expand Down
6 changes: 4 additions & 2 deletions packages/decap-cms-core/src/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from 'react-dom';
import { createRoot } from 'react-dom/client';
import { Provider, connect } from 'react-redux';
import { Route, Router } from 'react-router-dom';
import { GlobalStyles } from 'decap-cms-ui-default';
Expand Down Expand Up @@ -96,7 +96,9 @@ function bootstrap(opts = {}) {
/**
* Render application root.
*/
render(<Root />, getRoot());

const root = createRoot(getRoot());
root.render(<Root />);
}

export default bootstrap;
3 changes: 1 addition & 2 deletions packages/decap-cms-core/src/components/App/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { hot } from 'react-hot-loader';
import { translate } from 'react-polyglot';
import ImmutablePropTypes from 'react-immutable-proptypes';
import styled from '@emotion/styled';
Expand Down Expand Up @@ -277,4 +276,4 @@ const mapDispatchToProps = {
logoutUser,
};

export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(translate()(App)));
export default connect(mapStateToProps, mapDispatchToProps)(translate()(App));
2 changes: 1 addition & 1 deletion packages/decap-cms-core/src/components/App/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import styled from '@emotion/styled';
import { css } from '@emotion/core';
import { css } from '@emotion/react';
import { translate } from 'react-polyglot';
import { NavLink } from 'react-router-dom';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { css } from '@emotion/core';
import { css } from '@emotion/react';
import styled from '@emotion/styled';
import { buttons, StyledDropdownButton, colors } from 'decap-cms-ui-default';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { List } from 'immutable';
import { css } from '@emotion/core';
import { css } from '@emotion/react';
import styled from '@emotion/styled';
import { connect } from 'react-redux';
import { NavLink } from 'react-router-dom';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import styled from '@emotion/styled';
import { css } from '@emotion/core';
import { css } from '@emotion/react';
import { translate } from 'react-polyglot';
import { NavLink } from 'react-router-dom';
import { Icon, components, colors } from 'decap-cms-ui-default';
Expand Down
Loading
Loading