Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
React 16 (#7174)
Browse files Browse the repository at this point in the history
* Update packages to use React 16

* Rollback to react-router v3

* Use component instead of pure one

* Remove warning about mobx

* Make webpack load css from @parity/ui

* Update enzyme to support react16

* Fix lint

* Use @parity/ui v3

* Update refs of plugin-signer-* deps

* Exclude plugin-signer-* from babel processing

* Reupdate refs to old method

* Update refs again
  • Loading branch information
amaury1093 authored and jacogr committed Dec 1, 2017
1 parent 7663451 commit 2a7b2c7
Show file tree
Hide file tree
Showing 8 changed files with 1,895 additions and 651 deletions.
2,469 changes: 1,850 additions & 619 deletions js/package-lock.json

Large diffs are not rendered by default.

30 changes: 18 additions & 12 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"babel-register": "6.26.0",
"chai": "3.5.0",
"chai-as-promised": "6.0.0",
"chai-enzyme": "0.6.1",
"chai-enzyme": "1.0.0-beta.0",
"chalk": "1.1.3",
"copy-webpack-plugin": "4.0.1",
"core-js": "2.4.1",
Expand All @@ -87,7 +87,8 @@
"ejsify": "1.0.0",
"electron": "1.7.5",
"empty-module": "0.0.2",
"enzyme": "2.9.1",
"enzyme": "3.2.0",
"enzyme-adapter-react-16": "1.1.0",
"eslint": "3.16.1",
"eslint-config-semistandard": "7.0.0",
"eslint-config-standard": "6.2.1",
Expand Down Expand Up @@ -120,8 +121,8 @@
"progress": "1.1.8",
"raw-loader": "0.5.1",
"react-addons-perf": "15.4.2",
"react-addons-test-utils": "15.4.2",
"react-hot-loader": "3.0.0-beta.6",
"react-addons-test-utils": "15.6.2",
"react-hot-loader": "3.1.3",
"react-intl-aggregate-webpack-plugin": "0.0.1",
"rimraf": "2.6.2",
"sinon": "1.17.7",
Expand Down Expand Up @@ -150,22 +151,27 @@
"@parity/plugin-signer-hardware": "paritytech/plugin-signer-hardware",
"@parity/plugin-signer-qr": "paritytech/plugin-signer-qr",
"@parity/shared": "2.2.x",
"@parity/ui": "2.2.x",
"@parity/ui": "3.0.x",
"keythereum": "1.0.2",
"lodash.flatten": "4.4.0",
"lodash.omitby": "4.6.0",
"lodash.throttle": "4.1.1",
"lodash.uniq": "4.5.0",
"material-ui": "0.16.5",
"mobx": "3.3.2",
"mobx-react": "4.3.5",
"prop-types": "15.5.10",
"query-string": "5.0.1",
"react": "15.6.1",
"react-dom": "15.6.1",
"react-intl": "2.1.5",
"react-markdown": "2.5.0",
"react-router": "3.0.0",
"react-tap-event-plugin": "2.0.1",
"redux": "3.6.0",
"react": "16.1.1",
"react-dom": "16.1.1",
"react-intl": "2.4.0",
"react-markdown": "3.0.2",
"react-redux": "^5.0.6",
"react-router": "3.2.0",
"react-router-redux": "4.0.8",
"react-tap-event-plugin": "3.0.2",
"react-transition-group": "2.2.1",
"redux": "3.7.2",
"solc": "ngotchac/solc-js",
"store": "1.3.20",
"web3": "0.17.0-beta"
Expand Down
1 change: 0 additions & 1 deletion js/src/Dapp/dapp.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
opacity: 0;
width: 100%;
z-index: 1;
background: white;
}

.full {
Expand Down
4 changes: 2 additions & 2 deletions js/src/DappRequests/dappRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

import { observer } from 'mobx-react';
import React, { PureComponent } from 'react';
import React, { Component } from 'react';

import RequestGroups from './RequestGroups';
import Store from './store';
import styles from './dappRequests.css';

class DappRequests extends PureComponent {
class DappRequests extends Component {
store = Store.get();

handleApproveRequestGroup = requestIds => {
Expand Down
5 changes: 5 additions & 0 deletions js/src/index.parity.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ injectTapEventPlugin();

window.React = window.React || React;

// FIXME
// Not working with React 16
// https://reactjs.org/docs/perf.html
/*
if (process.env.NODE_ENV === 'development') {
// Expose the React Performance Tools on the`window` object
const Perf = require('react-addons-perf');
window.Perf = Perf;
}
*/

const AUTH_HASH = '#/auth?';

Expand Down
2 changes: 1 addition & 1 deletion js/src/shellMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

import mobx from 'mobx';
import * as mobx from 'mobx';
import flatten from 'lodash.flatten';

import { sha3 } from '@parity/api/lib/util/sha3';
Expand Down
5 changes: 4 additions & 1 deletion js/test/mocha.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ es6Promise.polyfill();
import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin();

import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import chaiEnzyme from 'chai-enzyme';
Expand All @@ -31,6 +33,7 @@ import sinonChai from 'sinon-chai';
import { WebSocket } from 'mock-socket';
import jsdom from 'jsdom';

Enzyme.configure({ adapter: new Adapter() });
chai.use(chaiAsPromised);
chai.use(chaiEnzyme());
chai.use(sinonChai);
Expand All @@ -44,7 +47,7 @@ global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
global.window = document.defaultView;
global.navigator = global.window.navigator;
global.location = global.window.location;
global.Blob = () => {};
global.Blob = () => { };

// attach mocked localStorage onto the window as exposed by jsdom
global.window.localStorage = global.localStorage;
Expand Down
30 changes: 15 additions & 15 deletions js/webpack/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ module.exports = {
{
test: /\.js$/,
exclude: /node_modules/,
use: [ {
use: [{
loader: 'happypack/loader',
options: {
id: 'babel'
}
} ]
}]
},
{
test: /\.json$/,
Expand All @@ -90,7 +90,7 @@ module.exports = {
},
{
test: /\.css$/,
include: /semantic-ui-css/,
include: /semantic-ui-css|@parity\/ui/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
Expand All @@ -105,7 +105,7 @@ module.exports = {
},
{
test: /\.css$/,
exclude: /semantic-ui-css/,
exclude: /semantic-ui-css|@parity\/ui/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
Expand Down Expand Up @@ -231,17 +231,17 @@ module.exports = {
isProd ? null : 'dist.css.map',
isProd ? null : 'dist.js.map'
]
.filter((file) => file)
.map((file) => path.join(dir, file))
.filter((from) => fs.existsSync(from))
.map((from) => ({
from,
to: `dapps/${destination}/`
}))
.concat({
from: path.join(dir, 'dist'),
to: `dapps/${destination}/dist/`
});
.filter((file) => file)
.map((file) => path.join(dir, file))
.filter((from) => fs.existsSync(from))
.map((from) => ({
from,
to: `dapps/${destination}/`
}))
.concat({
from: path.join(dir, 'dist'),
to: `dapps/${destination}/dist/`
});
})
.filter((copy) => copy)
)
Expand Down

0 comments on commit 2a7b2c7

Please sign in to comment.