From 604661ca2afa686508492ac3eee8c327bf47eb68 Mon Sep 17 00:00:00 2001 From: Filip Barl Date: Wed, 23 Nov 2016 15:59:41 +0100 Subject: [PATCH] Update package.json (#2017) --- client/.babelrc | 3 +- .../components/__tests__/node-details-test.js | 2 +- .../__tests__/node-details-table-test.js | 2 +- client/app/scripts/contrast-main.js | 24 +++-- client/app/scripts/main.dev.js | 26 +++-- client/app/scripts/main.js | 26 +++-- client/app/scripts/terminal-main.js | 25 +++-- client/app/styles/main.less | 6 +- client/package.json | 94 +++++++++---------- client/server.js | 3 + client/webpack.local.config.js | 22 +++-- 11 files changed, 135 insertions(+), 98 deletions(-) diff --git a/client/.babelrc b/client/.babelrc index 86c445f54..e936772e3 100644 --- a/client/.babelrc +++ b/client/.babelrc @@ -1,3 +1,4 @@ { - "presets": ["es2015", "react"] + "presets": ["es2015", "react"], + "plugins": ["react-hot-loader/babel"] } diff --git a/client/app/scripts/components/__tests__/node-details-test.js b/client/app/scripts/components/__tests__/node-details-test.js index 489a8051f..461c8b14d 100644 --- a/client/app/scripts/components/__tests__/node-details-test.js +++ b/client/app/scripts/components/__tests__/node-details-test.js @@ -1,6 +1,6 @@ import React from 'react'; import Immutable from 'immutable'; -import TestUtils from 'react/lib/ReactTestUtils'; +import TestUtils from 'react-dom/lib/ReactTestUtils'; import { Provider } from 'react-redux'; import configureStore from '../../stores/configureStore'; diff --git a/client/app/scripts/components/node-details/__tests__/node-details-table-test.js b/client/app/scripts/components/node-details/__tests__/node-details-table-test.js index 2aee7c186..37019ee53 100644 --- a/client/app/scripts/components/node-details/__tests__/node-details-table-test.js +++ b/client/app/scripts/components/node-details/__tests__/node-details-table-test.js @@ -1,5 +1,5 @@ import React from 'react'; -import TestUtils from 'react/lib/ReactTestUtils'; +import TestUtils from 'react-dom/lib/ReactTestUtils'; import { Provider } from 'react-redux'; import configureStore from '../../../stores/configureStore'; diff --git a/client/app/scripts/contrast-main.js b/client/app/scripts/contrast-main.js index be647be61..dd203a9e9 100644 --- a/client/app/scripts/contrast-main.js +++ b/client/app/scripts/contrast-main.js @@ -6,15 +6,23 @@ import 'babel-polyfill'; import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; - +import { AppContainer } from 'react-hot-loader'; import configureStore from './stores/configureStore'; -import App from './components/app.js'; const store = configureStore(); -ReactDOM.render( - - - , - document.getElementById('app') -); +function renderApp() { + const App = require('./components/app').default; + ReactDOM.render(( + + + + + + ), document.getElementById('app')); +} + +renderApp(); +if (module.hot) { + module.hot.accept('./components/app', renderApp); +} diff --git a/client/app/scripts/main.dev.js b/client/app/scripts/main.dev.js index 377885d63..93db134e9 100644 --- a/client/app/scripts/main.dev.js +++ b/client/app/scripts/main.dev.js @@ -6,9 +6,8 @@ import 'babel-polyfill'; import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; - +import { AppContainer } from 'react-hot-loader'; import configureStore from './stores/configureStore.dev'; -import App from './components/app'; import DevTools from './components/dev-tools'; import Immutable from 'immutable'; @@ -17,12 +16,19 @@ installDevTools(Immutable); const store = configureStore(); -ReactDOM.render( - -
- +function renderApp() { + const App = require('./components/app').default; + ReactDOM.render(( + + + + -
-
, - document.getElementById('app') -); + + ), document.getElementById('app')); +} + +renderApp(); +if (module.hot) { + module.hot.accept('./components/app', renderApp); +} diff --git a/client/app/scripts/main.js b/client/app/scripts/main.js index 0132b87bb..147755f93 100644 --- a/client/app/scripts/main.js +++ b/client/app/scripts/main.js @@ -6,17 +6,23 @@ import 'babel-polyfill'; import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; - +import { AppContainer } from 'react-hot-loader'; import configureStore from './stores/configureStore'; -import App from './components/app'; const store = configureStore(); -ReactDOM.render( - -
- -
-
, - document.getElementById('app') -); +function renderApp() { + const App = require('./components/app').default; + ReactDOM.render(( + + + + + + ), document.getElementById('app')); +} + +renderApp(); +if (module.hot) { + module.hot.accept('./components/app', renderApp); +} diff --git a/client/app/scripts/terminal-main.js b/client/app/scripts/terminal-main.js index 3feeee7e4..7e2f2e75e 100644 --- a/client/app/scripts/terminal-main.js +++ b/client/app/scripts/terminal-main.js @@ -5,15 +5,24 @@ import 'babel-polyfill'; import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; - +import { AppContainer } from 'react-hot-loader'; import configureStore from './stores/configureStore'; -import TerminalApp from './components/terminal-app.js'; const store = configureStore(); -ReactDOM.render( - - - , - document.getElementById('app') -); +function renderApp() { + const TerminalApp = require('./components/terminal-app').default; + ReactDOM.render( + + + + + , + document.getElementById('app') + ); +} + +renderApp(); +if (module.hot) { + module.hot.accept('./components/terminal-app', renderApp); +} diff --git a/client/app/styles/main.less b/client/app/styles/main.less index cc8283168..f1612b1c5 100644 --- a/client/app/styles/main.less +++ b/client/app/styles/main.less @@ -1,9 +1,9 @@ @import (inline) '../../node_modules/xterm/dist/xterm.css'; @font-face { font-family: "Roboto"; - src: url("../../node_modules/materialize-css/font/roboto/Roboto-Regular.woff2"), - url("../../node_modules/materialize-css/font/roboto/Roboto-Regular.woff"), - url("../../node_modules/materialize-css/font/roboto/Roboto-Regular.ttf"); + src: url("../../node_modules/materialize-css/fonts/roboto/Roboto-Regular.woff2"), + url("../../node_modules/materialize-css/fonts/roboto/Roboto-Regular.woff"), + url("../../node_modules/materialize-css/fonts/roboto/Roboto-Regular.ttf"); } .browsehappy { diff --git a/client/package.json b/client/package.json index b4bafa0d9..c5505b938 100644 --- a/client/package.json +++ b/client/package.json @@ -6,75 +6,75 @@ "license": "Apache-2.0", "private": true, "dependencies": { - "babel-polyfill": "6.7.4", - "classnames": "~2.2.1", + "babel-polyfill": "~6.16.0", + "classnames": "~2.2.5", "d3": "~3.5.5", "dagre": "0.7.4", - "debug": "~2.2.0", - "filesize": "3.2.1", - "font-awesome": "4.5.0", + "debug": "~2.3.3", + "filesize": "~3.3.0", + "font-awesome": "~4.7.0", "font-awesome-webpack": "0.0.4", - "immutable": "~3.7.4", - "lcp": "1.0.0", - "lodash": "~4.6.1", - "materialize-css": "0.97.5", - "moment": "2.12.0", - "page": "1.7.0", - "react": "^15.0.1", - "react-dom": "^15.0.1", - "react-motion": "0.3.1", - "react-redux": "4.4.5", - "redux": "3.5.1", - "redux-immutable": "3.0.6", - "redux-logger": "2.6.1", - "redux-thunk": "2.0.1", + "immutable": "~3.8.1", + "lcp": "~1.1.0", + "lodash": "~4.17.2", + "materialize-css": "0.97.8", + "moment": "~2.17.0", + "page": "~1.7.1", + "react": "~15.4.1", + "react-dom": "~15.4.1", + "react-motion": "~0.4.5", + "react-redux": "~4.4.6", + "redux": "~3.6.0", + "redux-immutable": "~3.0.8", + "redux-logger": "~2.7.4", + "redux-thunk": "~2.1.0", "reqwest": "~2.0.5", - "reselect": "^2.5.3", + "reselect": "~2.5.4", "timely": "0.1.0", - "whatwg-fetch": "0.11.0", - "xterm": "^2.0.1" + "whatwg-fetch": "~2.0.1", + "xterm": "~2.1.0" }, "devDependencies": { - "autoprefixer": "6.3.3", - "babel-core": "6.10.4", + "autoprefixer": "~6.5.3", + "babel-core": "~6.18.2", "babel-eslint": "5.0.0", - "babel-jest": "9.0.3", - "babel-loader": "6.2.4", - "babel-preset-es2015": "6.6.0", - "babel-preset-react": "6.5.0", - "clean-webpack-plugin": "^0.1.8", - "css-loader": "0.23.1", + "babel-jest": "~17.0.2", + "babel-loader": "~6.2.8", + "babel-preset-es2015": "6.18.0", + "babel-preset-react": "6.16.0", + "clean-webpack-plugin": "~0.1.14", + "css-loader": "0.26.0", "eslint": "2.4.0", "eslint-config-airbnb": "6.1.0", "eslint-loader": "1.3.0", "eslint-plugin-jasmine": "1.6.0", "eslint-plugin-react": "4.2.2", "extract-text-webpack-plugin": "^1.0.1", - "file-loader": "0.8.5", - "html-webpack-plugin": "^2.16.0", + "file-loader": "0.9.0", + "html-webpack-plugin": "^2.24.1", "http-proxy-rules": "^1.0.1", - "immutable-devtools": "0.0.6", - "jest-cli": "16.0.2", + "immutable-devtools": "0.0.7", + "jest-cli": "~17.0.3", "json-loader": "0.5.4", - "less": "~2.6.1", - "less-loader": "2.2.2", - "postcss-loader": "0.8.2", - "react-addons-perf": "^15.0.1", - "redux-devtools": "^3.2.0", + "less": "~2.7.1", + "less-loader": "~2.2.3", + "postcss-loader": "~1.1.1", + "react-addons-perf": "~15.4.1", + "redux-devtools": "^3.3.1", "redux-devtools-dock-monitor": "^1.1.1", - "redux-devtools-log-monitor": "^1.0.11", - "style-loader": "0.13.0", + "redux-devtools-log-monitor": "^1.1.1", + "style-loader": "0.13.1", "url": "0.11.0", "url-loader": "0.5.7", - "webpack": "~1.12.4" + "webpack": "~1.13.3" }, "optionalDependencies": { "browser-perf": "^1.4.5", - "express": "~4.13.3", - "http-proxy": "^1.12.0", + "express": "~4.14.0", + "http-proxy": "^1.15.2", "perfjankie": "^2.1.0", - "react-hot-loader": "~1.3.0", - "webpack-dev-server": "~1.14.1" + "react-hot-loader": "3.0.0-beta.6", + "webpack-dev-server": "~1.16.2" }, "scripts": { "build": "webpack --config webpack.production.config.js", @@ -89,7 +89,7 @@ "loadreport": "npm run noprobe && sleep 1 && curl -X POST -H \"Content-Type: application/json\" http://$BACKEND_HOST/api/report -d" }, "jest": { - "scriptPreprocessor": "/node_modules/babel-jest", + "transform": {".*": "/node_modules/babel-jest"}, "testPathDirs": [ "/app/scripts" ], diff --git a/client/server.js b/client/server.js index 3b984ba1f..2da0e15d3 100644 --- a/client/server.js +++ b/client/server.js @@ -67,6 +67,9 @@ if (process.env.NODE_ENV !== 'production') { noInfo: true, historyApiFallback: true, stats: 'errors-only', + // We need the access from the express server for the hot-loader. + // See: https://github.com/gaearon/react-hot-loader/issues/56 + headers: { "Access-Control-Allow-Origin": '*' }, }).listen(4041, '0.0.0.0', function (err, result) { if (err) { console.log(err); diff --git a/client/webpack.local.config.js b/client/webpack.local.config.js index 9ffdb172e..23ff25bdf 100644 --- a/client/webpack.local.config.js +++ b/client/webpack.local.config.js @@ -26,24 +26,28 @@ module.exports = { // Set entry point include necessary files for hot load entry: { app: [ - './app/scripts/main', + 'react-hot-loader/patch', DEV_SERVER_URL, - 'webpack/hot/only-dev-server' + 'webpack/hot/only-dev-server', + './app/scripts/main', ], 'dev-app': [ - './app/scripts/main.dev', + 'react-hot-loader/patch', DEV_SERVER_URL, - 'webpack/hot/only-dev-server' + 'webpack/hot/only-dev-server', + './app/scripts/main.dev', ], 'contrast-app': [ - './app/scripts/contrast-main', + 'react-hot-loader/patch', DEV_SERVER_URL, - 'webpack/hot/only-dev-server' + 'webpack/hot/only-dev-server', + './app/scripts/contrast-main', ], 'terminal-app': [ - './app/scripts/terminal-main', + 'react-hot-loader/patch', DEV_SERVER_URL, - 'webpack/hot/only-dev-server' + 'webpack/hot/only-dev-server', + './app/scripts/terminal-main', ], vendors: ['babel-polyfill', 'classnames', 'd3', 'dagre', 'filesize', 'immutable', 'lodash', 'moment', 'page', 'react', 'react-dom', 'react-motion', 'react-redux', 'redux', @@ -121,7 +125,7 @@ module.exports = { { test: /\.jsx?$/, exclude: /node_modules|vendor/, - loaders: ['react-hot', 'babel'] + loaders: ['babel'] } ] },