From 1291130f9e976a8b9f1fbbbe4cf256d1974d541a Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Thu, 24 Nov 2016 02:28:33 +0100 Subject: [PATCH 01/38] Simpler Webpack config : create HTML files for dapps --- js/package.json | 199 ++++++++++---------- js/src/dapps/basiccoin.html | 17 -- js/src/dapps/basiccoin.js | 1 - js/src/dapps/dappreg.html | 17 -- js/src/dapps/dappreg.js | 1 - js/src/dapps/githubhint.js | 1 - js/src/dapps/{githubhint.html => index.ejs} | 8 +- js/src/dapps/localtx.html | 17 -- js/src/dapps/localtx.js | 1 - js/src/dapps/registry.html | 17 -- js/src/dapps/registry.js | 1 - js/src/dapps/signaturereg.html | 17 -- js/src/dapps/signaturereg.js | 1 - js/src/dapps/tokenreg.html | 17 -- js/src/dapps/tokenreg.js | 1 - js/src/{index.html => index.ejs} | 5 +- js/src/index.js | 1 - js/webpack.config.js | 62 ++++-- 18 files changed, 153 insertions(+), 231 deletions(-) delete mode 100644 js/src/dapps/basiccoin.html delete mode 100644 js/src/dapps/dappreg.html rename js/src/dapps/{githubhint.html => index.ejs} (59%) delete mode 100644 js/src/dapps/localtx.html delete mode 100644 js/src/dapps/registry.html delete mode 100644 js/src/dapps/signaturereg.html delete mode 100644 js/src/dapps/tokenreg.html rename js/src/{index.html => index.ejs} (67%) diff --git a/js/package.json b/js/package.json index 490ec7bb1..43aabcc52 100644 --- a/js/package.json +++ b/js/package.json @@ -47,127 +47,128 @@ "prepush": "npm run lint:cached" }, "devDependencies": { - "babel-cli": "^6.10.1", - "babel-core": "^6.10.4", - "babel-eslint": "^7.1.0", - "babel-loader": "^6.2.3", - "babel-plugin-lodash": "^3.2.2", - "babel-plugin-transform-class-properties": "^6.11.5", - "babel-plugin-transform-decorators-legacy": "^1.3.4", - "babel-plugin-transform-react-remove-prop-types": "^0.2.9", - "babel-plugin-transform-runtime": "^6.9.0", - "babel-polyfill": "^6.13.0", - "babel-preset-es2015": "^6.9.0", - "babel-preset-es2015-rollup": "^1.1.1", - "babel-preset-es2016": "^6.11.3", - "babel-preset-es2017": "^6.14.0", - "babel-preset-react": "^6.5.0", - "babel-preset-stage-0": "^6.5.0", + "babel-cli": "~6.10.1", + "babel-core": "~6.10.4", + "babel-eslint": "~7.1.0", + "babel-loader": "~6.2.3", + "babel-plugin-lodash": "~3.2.2", + "babel-plugin-transform-class-properties": "~6.11.5", + "babel-plugin-transform-decorators-legacy": "~1.3.4", + "babel-plugin-transform-react-remove-prop-types": "~0.2.9", + "babel-plugin-transform-runtime": "~6.9.0", + "babel-polyfill": "~6.13.0", + "babel-preset-es2015": "~6.9.0", + "babel-preset-es2015-rollup": "~1.1.1", + "babel-preset-es2016": "~6.11.3", + "babel-preset-es2017": "~6.14.0", + "babel-preset-react": "~6.5.0", + "babel-preset-stage-0": "~6.5.0", "babel-register": "6.9.0", - "babel-runtime": "^6.9.2", - "chai": "^3.5.0", + "babel-runtime": "~6.9.2", + "chai": "~3.5.0", "chai-enzyme": "0.4.2", "cheerio": "0.20.0", - "copy-webpack-plugin": "^4.0.0", - "core-js": "^2.4.1", - "coveralls": "^2.11.11", - "css-loader": "^0.23.1", + "copy-webpack-plugin": "~4.0.0", + "core-js": "~2.4.1", + "coveralls": "~2.11.11", + "css-loader": "~0.23.1", "enzyme": "2.3.0", - "eslint": "^3.1.0", - "eslint-config-semistandard": "^6.0.2", - "eslint-config-standard": "^5.3.5", - "eslint-config-standard-react": "^3.0.0", - "eslint-plugin-promise": "^2.0.0", - "eslint-plugin-react": "^5.1.1", - "eslint-plugin-standard": "^2.0.0", + "eslint": "~3.1.0", + "eslint-config-semistandard": "~6.0.2", + "eslint-config-standard": "~5.3.5", + "eslint-config-standard-react": "~3.0.0", + "eslint-plugin-promise": "~2.0.0", + "eslint-plugin-react": "~5.1.1", + "eslint-plugin-standard": "~2.0.0", "extract-loader": "0.0.2", - "extract-text-webpack-plugin": "^1.0.1", - "file-loader": "^0.8.5", - "fs-extra": "^0.30.0", - "happypack": "^2.2.1", - "history": "^2.0.0", - "html-loader": "^0.4.4", - "husky": "^0.11.9", + "extract-text-webpack-plugin": "~1.0.1", + "file-loader": "~0.8.5", + "fs-extra": "~0.30.0", + "happypack": "~2.2.1", + "history": "~2.0.0", + "html-loader": "~0.4.4", + "html-webpack-plugin": "~2.24.1", + "husky": "~0.11.9", "ignore-styles": "2.0.0", - "image-webpack-loader": "^1.8.0", - "istanbul": "^1.0.0-alpha.2", + "image-webpack-loader": "~1.8.0", + "istanbul": "~1.0.0-alpha.2", "jsdom": "9.2.1", - "json-loader": "^0.5.4", - "mocha": "^3.0.0-1", + "json-loader": "~0.5.4", + "mocha": "~3.0.0-1", "mock-local-storage": "1.0.2", - "mock-socket": "^3.0.1", - "nock": "^8.0.0", - "postcss-import": "^8.1.2", - "postcss-loader": "^0.8.1", - "postcss-nested": "^1.0.0", - "postcss-simple-vars": "^3.0.0", - "raw-loader": "^0.5.1", + "mock-socket": "~3.0.1", + "nock": "~8.0.0", + "postcss-import": "~8.1.2", + "postcss-loader": "~0.8.1", + "postcss-nested": "~1.0.0", + "postcss-simple-vars": "~3.0.0", + "raw-loader": "~0.5.1", "react-addons-perf": "~15.3.2", "react-addons-test-utils": "~15.3.2", - "react-copy-to-clipboard": "^4.2.3", + "react-copy-to-clipboard": "~4.2.3", "react-dom": "~15.3.2", "react-hot-loader": "~1.3.0", - "rucksack-css": "^0.8.6", - "sinon": "^1.17.4", - "sinon-as-promised": "^4.0.2", - "sinon-chai": "^2.8.0", - "style-loader": "^0.13.0", - "url-loader": "^0.5.7", - "webpack": "^1.13.2", - "webpack-dev-server": "^1.15.2", + "rucksack-css": "~0.8.6", + "sinon": "~1.17.4", + "sinon-as-promised": "~4.0.2", + "sinon-chai": "~2.8.0", + "style-loader": "~0.13.0", + "url-loader": "~0.5.7", + "webpack": "~1.13.2", + "webpack-dev-server": "~1.15.2", "webpack-error-notification": "0.1.6", "webpack-hot-middleware": "~2.13.2", - "websocket": "^1.0.23" + "websocket": "~1.0.23" }, "dependencies": { - "bignumber.js": "^2.3.0", + "bignumber.js": "~2.3.0", "blockies": "0.0.2", - "brace": "^0.9.0", - "bytes": "^2.4.0", - "chart.js": "^2.3.0", - "es6-error": "^4.0.0", - "es6-promise": "^3.2.1", - "ethereumjs-tx": "^1.1.2", - "file-saver": "^1.3.3", - "format-json": "^1.0.3", - "format-number": "^2.0.1", - "geopattern": "^1.2.3", - "isomorphic-fetch": "^2.2.1", - "js-sha3": "^0.5.2", - "lodash": "^4.11.1", - "marked": "^0.3.6", + "brace": "~0.9.0", + "bytes": "~2.4.0", + "chart.js": "~2.3.0", + "es6-error": "~4.0.0", + "es6-promise": "~3.2.1", + "ethereumjs-tx": "~1.1.2", + "file-saver": "~1.3.3", + "format-json": "~1.0.3", + "format-number": "~2.0.1", + "geopattern": "~1.2.3", + "isomorphic-fetch": "~2.2.1", + "js-sha3": "~0.5.2", + "lodash": "~4.11.1", + "marked": "~0.3.6", "material-ui": "0.16.1", - "material-ui-chip-input": "^0.8.0", - "mobx": "^2.6.1", - "mobx-react": "^3.5.8", - "mobx-react-devtools": "^4.2.9", - "moment": "^2.14.1", - "phoneformat.js": "^1.0.3", - "qs": "^6.3.0", + "material-ui-chip-input": "~0.8.0", + "mobx": "~2.6.1", + "mobx-react": "~3.5.8", + "mobx-react-devtools": "~4.2.9", + "moment": "~2.14.1", + "phoneformat.js": "~1.0.3", + "qs": "~6.3.0", "react": "~15.3.2", - "react-ace": "^4.0.0", + "react-ace": "~4.0.0", "react-addons-css-transition-group": "~15.3.2", - "react-chartjs-2": "^1.5.0", + "react-chartjs-2": "~1.5.0", "react-dom": "~15.3.2", - "react-dropzone": "^3.7.3", - "react-redux": "^4.4.5", - "react-router": "^2.6.1", - "react-router-redux": "^4.0.5", + "react-dropzone": "~3.7.3", + "react-redux": "~4.4.5", + "react-router": "~2.6.1", + "react-router-redux": "~4.0.5", "react-tap-event-plugin": "~1.0.0", - "react-tooltip": "^2.0.3", - "recharts": "^0.15.2", - "redux": "^3.5.2", - "redux-actions": "^0.10.1", - "redux-thunk": "^2.1.0", - "rlp": "^2.0.0", - "scryptsy": "^2.0.0", + "react-tooltip": "~2.0.3", + "recharts": "~0.15.2", + "redux": "~3.5.2", + "redux-actions": "~0.10.1", + "redux-thunk": "~2.1.0", + "rlp": "~2.0.0", + "scryptsy": "~2.0.0", "solc": "ngotchac/solc-js", - "store": "^1.3.20", - "utf8": "^2.1.1", - "valid-url": "^1.0.9", - "validator": "^5.7.0", - "web3": "^0.17.0-beta", - "whatwg-fetch": "^1.0.0", - "worker-loader": "^0.7.1" + "store": "~1.3.20", + "utf8": "~2.1.1", + "valid-url": "~1.0.9", + "validator": "~5.7.0", + "web3": "~0.17.0-beta", + "whatwg-fetch": "~1.0.0", + "worker-loader": "~0.7.1" } } diff --git a/js/src/dapps/basiccoin.html b/js/src/dapps/basiccoin.html deleted file mode 100644 index 52bc8bc57..000000000 --- a/js/src/dapps/basiccoin.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - Basic Token Deployment - - -
- - - - - - diff --git a/js/src/dapps/basiccoin.js b/js/src/dapps/basiccoin.js index e02990d14..a64afa0b9 100644 --- a/js/src/dapps/basiccoin.js +++ b/js/src/dapps/basiccoin.js @@ -32,7 +32,6 @@ const routerHistory = useRouterHistory(createHashHistory)({}); import '../../assets/fonts/Roboto/font.css'; import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; -import './basiccoin.html'; ReactDOM.render( diff --git a/js/src/dapps/dappreg.html b/js/src/dapps/dappreg.html deleted file mode 100644 index 89c95c472..000000000 --- a/js/src/dapps/dappreg.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - Dapp Registry - - -
- - - - - - diff --git a/js/src/dapps/dappreg.js b/js/src/dapps/dappreg.js index 243576a34..8ed9724bc 100644 --- a/js/src/dapps/dappreg.js +++ b/js/src/dapps/dappreg.js @@ -27,7 +27,6 @@ import Application from './dappreg/Application'; import '../../assets/fonts/Roboto/font.css'; import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; -import './dappreg.html'; ReactDOM.render( , diff --git a/js/src/dapps/githubhint.js b/js/src/dapps/githubhint.js index b73702990..ab807a44b 100644 --- a/js/src/dapps/githubhint.js +++ b/js/src/dapps/githubhint.js @@ -25,7 +25,6 @@ import Application from './githubhint/Application'; import '../../assets/fonts/Roboto/font.css'; import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; -import './githubhint.html'; ReactDOM.render( , diff --git a/js/src/dapps/githubhint.html b/js/src/dapps/index.ejs similarity index 59% rename from js/src/dapps/githubhint.html rename to js/src/dapps/index.ejs index 746c7f466..13d70473f 100644 --- a/js/src/dapps/githubhint.html +++ b/js/src/dapps/index.ejs @@ -4,13 +4,13 @@ - - GitHub Hint + <%= htmlWebpackPlugin.options.title %>
- - + <% if (!htmlWebpackPlugin.options.secure) { %> + + <% } %> diff --git a/js/src/dapps/localtx.html b/js/src/dapps/localtx.html deleted file mode 100644 index d1e6fed05..000000000 --- a/js/src/dapps/localtx.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - Local transactions Viewer - - -
- - - - - - diff --git a/js/src/dapps/localtx.js b/js/src/dapps/localtx.js index 98561f33f..3e848ede9 100644 --- a/js/src/dapps/localtx.js +++ b/js/src/dapps/localtx.js @@ -25,7 +25,6 @@ import Application from './localtx/Application'; import '../../assets/fonts/Roboto/font.css'; import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; -import './localtx.html'; ReactDOM.render( , diff --git a/js/src/dapps/registry.html b/js/src/dapps/registry.html deleted file mode 100644 index ab399d1e3..000000000 --- a/js/src/dapps/registry.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - Token Registry - - -
- - - - - - diff --git a/js/src/dapps/registry.js b/js/src/dapps/registry.js index ebcff155a..d132da3d8 100644 --- a/js/src/dapps/registry.js +++ b/js/src/dapps/registry.js @@ -27,7 +27,6 @@ import Container from './registry/Container'; import '../../assets/fonts/Roboto/font.css'; import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; -import './registry.html'; ReactDOM.render( diff --git a/js/src/dapps/signaturereg.html b/js/src/dapps/signaturereg.html deleted file mode 100644 index d050fe803..000000000 --- a/js/src/dapps/signaturereg.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - Method Signature Registry - - -
- - - - - - diff --git a/js/src/dapps/signaturereg.js b/js/src/dapps/signaturereg.js index 72ddd0ca7..d0d0cd423 100644 --- a/js/src/dapps/signaturereg.js +++ b/js/src/dapps/signaturereg.js @@ -25,7 +25,6 @@ import Application from './signaturereg/Application'; import '../../assets/fonts/Roboto/font.css'; import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; -import './signaturereg.html'; ReactDOM.render( , diff --git a/js/src/dapps/tokenreg.html b/js/src/dapps/tokenreg.html deleted file mode 100644 index d16d4082c..000000000 --- a/js/src/dapps/tokenreg.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - Token Registry - - -
- - - - - - diff --git a/js/src/dapps/tokenreg.js b/js/src/dapps/tokenreg.js index 8ca70e114..5e940ab08 100644 --- a/js/src/dapps/tokenreg.js +++ b/js/src/dapps/tokenreg.js @@ -27,7 +27,6 @@ import Container from './tokenreg/Container'; import '../../assets/fonts/Roboto/font.css'; import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; -import './tokenreg.html'; ReactDOM.render( ( diff --git a/js/src/index.html b/js/src/index.ejs similarity index 67% rename from js/src/index.html rename to js/src/index.ejs index 780013432..8428e39ad 100644 --- a/js/src/index.html +++ b/js/src/index.ejs @@ -4,8 +4,7 @@ - - Parity + <%= htmlWebpackPlugin.options.title %> -
+
+
+ Loading... +
+
<% if (!htmlWebpackPlugin.options.secure) { %> diff --git a/js/src/index.ejs b/js/src/index.ejs index 8428e39ad..eefc50dbb 100644 --- a/js/src/index.ejs +++ b/js/src/index.ejs @@ -7,12 +7,33 @@ <%= htmlWebpackPlugin.options.title %> -
+
+
+ Loading... +
+
diff --git a/js/webpack/config.js b/js/webpack/config.js index 65a999bb9..77eaceee5 100644 --- a/js/webpack/config.js +++ b/js/webpack/config.js @@ -15,12 +15,8 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -const path = require('path'); -const postcssImport = require('postcss-import'); -const postcssNested = require('postcss-nested'); -const postcssVars = require('postcss-simple-vars'); -const rucksack = require('rucksack-css'); const webpack = require('webpack'); +const path = require('path'); const WebpackErrorNotificationPlugin = require('webpack-error-notification'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); @@ -28,17 +24,11 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const Shared = require('./shared'); const DAPPS = require('../src/dapps'); -const ENV = process.env.NODE_ENV || 'development'; -const isProd = ENV === 'production'; -const DEST = process.env.BUILD_DEST || '.build'; - const FAVICON = path.resolve(__dirname, '../assets/images/parity-logo-black-no-text.png'); -// dapps -const entry = Shared.dappsEntry; - -// main UI -entry.index = './index.js'; +const DEST = process.env.BUILD_DEST || '.build'; +const ENV = process.env.NODE_ENV || 'development'; +const isProd = ENV === 'production'; module.exports = { debug: !isProd, @@ -46,7 +36,9 @@ module.exports = { devtool: isProd ? '#eval' : '#cheap-module-eval-source-map', context: path.join(__dirname, '../src'), - entry: entry, + entry: Object.assign({}, Shared.dappsEntry, { + index: './index.js' + }), output: { path: path.join(__dirname, '../', DEST), filename: '[name].[hash].js' @@ -113,20 +105,7 @@ module.exports = { attrs: ['img:src', 'link:href'] }, - postcss: [ - postcssImport({ - addDependencyTo: webpack - }), - postcssNested({}), - postcssVars({ - unknown: function (node, name, result) { - node.warn(result, `Unknown variable ${name}`); - } - }), - rucksack({ - autoprefixer: true - }) - ], + postcss: Shared.postcss, plugins: (function () { const plugins = Shared.getPlugins().concat([ diff --git a/js/webpack/shared.js b/js/webpack/shared.js index b5a46a11c..f5ef423b9 100644 --- a/js/webpack/shared.js +++ b/js/webpack/shared.js @@ -17,6 +17,11 @@ const webpack = require('webpack'); const HappyPack = require('happypack'); +const postcssImport = require('postcss-import'); +const postcssNested = require('postcss-nested'); +const postcssVars = require('postcss-simple-vars'); +const rucksack = require('rucksack-css'); + const ENV = process.env.NODE_ENV || 'development'; const isProd = ENV === 'production'; @@ -77,6 +82,21 @@ function getDappsEntry () { }, {}); } +const postcss = [ + postcssImport({ + addDependencyTo: webpack + }), + postcssNested({}), + postcssVars({ + unknown: function (node, name, result) { + node.warn(result, `Unknown variable ${name}`); + } + }), + rucksack({ + autoprefixer: true + }) +]; + const proxies = [ { context: (pathname, req) => { @@ -118,5 +138,6 @@ const proxies = [ module.exports = { getPlugins: getPlugins, dappsEntry: getDappsEntry(), + postcss: postcss, proxies: proxies }; From 24bdf1cb9886f0f78ea563f9008f7b5bf9c711b8 Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Fri, 25 Nov 2016 13:14:30 +0100 Subject: [PATCH 07/38] Use webpack hot/dev middlewares --- js/package.json | 6 +- js/src/views/Dapps/dappsStore.js | 10 ++- .../build.server.js} | 38 +++-------- js/webpack/config.js | 11 +-- js/webpack/dev.server.js | 68 +++++++++++++++++++ js/webpack/shared.js | 55 ++++++++------- js/webpack/vendor.js | 4 +- 7 files changed, 125 insertions(+), 67 deletions(-) rename js/{build-server.js => webpack/build.server.js} (66%) create mode 100644 js/webpack/dev.server.js diff --git a/js/package.json b/js/package.json index 0c7886673..e52ce8d6e 100644 --- a/js/package.json +++ b/js/package.json @@ -35,7 +35,7 @@ "ci:build:dll": "NODE_ENV=production webpack --config webpack/vendor", "ci:build:npm": "NODE_ENV=production webpack --config webpack/npm", "start": "npm install && npm run build:lib && npm run build:dll && npm run start:app", - "start:app": "webpack-dev-server --config webpack/config -d --history-api-fallback --open --hot --inline --progress --colors --port 3000", + "start:app": "node webpack/dev.server", "clean": "rm -rf ./build ./coverage", "coveralls": "npm run testCoverage && coveralls < coverage/lcov.info", "lint": "eslint --ignore-path .gitignore ./src/", @@ -80,6 +80,7 @@ "eslint-plugin-promise": "~2.0.0", "eslint-plugin-react": "~5.1.1", "eslint-plugin-standard": "~2.0.0", + "express": "~4.14.0", "extract-loader": "0.0.2", "extract-text-webpack-plugin": "~1.0.1", "file-loader": "~0.8.5", @@ -88,6 +89,7 @@ "history": "~2.0.0", "html-loader": "~0.4.4", "html-webpack-plugin": "~2.24.1", + "http-proxy-middleware": "~0.17.2", "husky": "~0.11.9", "ignore-styles": "2.0.0", "image-webpack-loader": "~1.8.0", @@ -115,7 +117,7 @@ "style-loader": "~0.13.0", "url-loader": "~0.5.7", "webpack": "~1.13.2", - "webpack-dev-server": "~1.15.2", + "webpack-dev-middleware": "~1.8.4", "webpack-error-notification": "0.1.6", "webpack-hot-middleware": "~2.13.2", "websocket": "~1.0.23" diff --git a/js/src/views/Dapps/dappsStore.js b/js/src/views/Dapps/dappsStore.js index f9fc4863c..9a86c3d8d 100644 --- a/js/src/views/Dapps/dappsStore.js +++ b/js/src/views/Dapps/dappsStore.js @@ -128,9 +128,15 @@ export default class DappsStore { } _getHost (api) { - return process.env.NODE_ENV === 'production' + const host = process.env.DAPPS_URL || (process.env.NODE_ENV === 'production' ? this._api.dappsUrl - : ''; + : ''); + + if (host === '/') { + return ''; + } + + return host; } _fetchBuiltinApps () { diff --git a/js/build-server.js b/js/webpack/build.server.js similarity index 66% rename from js/build-server.js rename to js/webpack/build.server.js index c10630ab0..c1e803f56 100644 --- a/js/build-server.js +++ b/js/webpack/build.server.js @@ -15,7 +15,7 @@ // along with Parity. If not, see . // test only /** - * Run `PARITY_URL="127.0.0.1:8180" NODE_ENV="production" npm run build` + * Run `DAPPS_URL="/" PARITY_URL="127.0.0.1:8180" NODE_ENV="production" npm run build` * to build the project ; use this server to test that the minifed * version is working (this is a simple proxy server) */ @@ -23,39 +23,17 @@ var express = require('express'); var proxy = require('http-proxy-middleware'); +var Shared = require('./shared'); + var app = express(); var wsProxy = proxy('ws://127.0.0.1:8180', { changeOrigin: true }); +Shared.addProxies(app); + app.use(express.static('.build')); - -app.use('/api/*', proxy({ - target: 'http://127.0.0.1:8080', - changeOrigin: true -})); - -app.use('/app/*', proxy({ - target: 'http://127.0.0.1:8080', - changeOrigin: true, - pathRewrite: { - '^/app': '' - } -})); - -app.use('/parity-utils/*', proxy({ - target: 'http://127.0.0.1:3000', - changeOrigin: true, - pathRewrite: { - '^/parity-utils': '' - } -})); - -app.use('/rpc/*', proxy({ - target: 'http://127.0.0.1:8080', - changeOrigin: true -})); - app.use(wsProxy); -var server = app.listen(3000); - +var server = app.listen(process.env.PORT || 3000, function () { + console.log('Listening on port', server.address().port); +}); server.on('upgrade', wsProxy.upgrade); diff --git a/js/webpack/config.js b/js/webpack/config.js index 77eaceee5..814c731a3 100644 --- a/js/webpack/config.js +++ b/js/webpack/config.js @@ -40,6 +40,7 @@ module.exports = { index: './index.js' }), output: { + publicPath: '/', path: path.join(__dirname, '../', DEST), filename: '[name].[hash].js' }, @@ -145,13 +146,5 @@ module.exports = { } return plugins; - }()), - - devServer: { - contentBase: path.resolve(__dirname, `../${DEST}`), - historyApiFallback: false, - quiet: false, - hot: !isProd, - proxy: Shared.proxies - } + }()) }; diff --git a/js/webpack/dev.server.js b/js/webpack/dev.server.js new file mode 100644 index 000000000..7ebdd815e --- /dev/null +++ b/js/webpack/dev.server.js @@ -0,0 +1,68 @@ +// Copyright 2015, 2016 Ethcore (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +const webpack = require('webpack'); +const webpackDevMiddleware = require('webpack-dev-middleware'); +const webpackHotMiddleware = require('webpack-hot-middleware'); + +const http = require('http'); +const express = require('express'); + +const webpackConfig = require('./config'); +const Shared = require('./shared'); + +const hotMiddlewareScript = 'webpack-hot-middleware/client'; + +/** + * Add webpack hot middleware to each entry in the config + * and HMR to the plugins + */ +(function updateWebpackConfig () { + Object.keys(webpackConfig.entry).forEach((key) => { + const entry = webpackConfig.entry[key]; + + webpackConfig.entry[key] = [].concat(entry, hotMiddlewareScript); + }); + + webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin()); + webpackConfig.plugins.push(new webpack.NoErrorsPlugin()); +})(); + +const app = express(); +const compiler = webpack(webpackConfig); + +app.use(webpackDevMiddleware(compiler, { + noInfo: false, + quiet: false, + publicPath: webpackConfig.output.publicPath, + stats: { + colors: true + } +})); + +app.use(webpackHotMiddleware(compiler, { + log: console.log +})); + +app.use(express.static(webpackConfig.output.path)); + +// Add the dev proxies in the express App +Shared.addProxies(app); + +const server = http.createServer(app); +server.listen(process.env.PORT || 3000, function () { + console.log('Listening on port', server.address().port); +}); diff --git a/js/webpack/shared.js b/js/webpack/shared.js index f5ef423b9..0fe3d3275 100644 --- a/js/webpack/shared.js +++ b/js/webpack/shared.js @@ -46,18 +46,26 @@ function getPlugins (_isProd = isProd) { ] }), + new HappyPack({ + id: 'babel', + threads: 4, + loaders: ['babel'] + }), + new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify(ENV), RPC_ADDRESS: JSON.stringify(process.env.RPC_ADDRESS), PARITY_URL: JSON.stringify(process.env.PARITY_URL), + DAPPS_URL: JSON.stringify(process.env.DAPPS_URL), LOGGING: JSON.stringify(!isProd) } - }) + }), + + new webpack.optimize.OccurrenceOrderPlugin(!_isProd) ]; if (_isProd) { - plugins.push(new webpack.optimize.OccurrenceOrderPlugin(false)); plugins.push(new webpack.optimize.DedupePlugin()); plugins.push(new webpack.optimize.UglifyJsPlugin({ screwIe8: true, @@ -97,47 +105,48 @@ const postcss = [ }) ]; -const proxies = [ - { - context: (pathname, req) => { - return pathname === '/' && req.method === 'HEAD'; - }, +function addProxies (app) { + const proxy = require('http-proxy-middleware'); + + app.use(proxy((pathname, req) => { + return pathname === '/' && req.method === 'HEAD'; + }, { target: 'http://127.0.0.1:8180', changeOrigin: true, autoRewrite: true - }, - { - context: '/api', + })); + + app.use('/api', proxy({ target: 'http://127.0.0.1:8080', changeOrigin: true, autoRewrite: true - }, - { - context: '/app', + })); + + app.use('/app', proxy({ target: 'http://127.0.0.1:8080', changeOrigin: true, pathRewrite: { '^/app': '' } - }, - { - context: '/parity-utils', + })); + + app.use('/parity-utils', proxy({ target: 'http://127.0.0.1:3000', changeOrigin: true, pathRewrite: { '^/parity-utils': '' } - }, - { - context: '/rpc', + })); + + app.use('/rpc', proxy({ target: 'http://127.0.0.1:8080', changeOrigin: true - } -]; + })); +} module.exports = { getPlugins: getPlugins, dappsEntry: getDappsEntry(), - postcss: postcss, - proxies: proxies + addProxies: addProxies, + postcss: postcss }; diff --git a/js/webpack/vendor.js b/js/webpack/vendor.js index 2e7edc771..c7efe3edf 100644 --- a/js/webpack/vendor.js +++ b/js/webpack/vendor.js @@ -29,6 +29,7 @@ let modules = [ 'brace', 'browserify-aes', 'chart.js', + 'ethereumjs-tx', 'lodash', 'material-ui', 'mobx', @@ -57,7 +58,8 @@ module.exports = { }, { test: /\.js$/, - loaders: [ 'happypack/loader?id=js' ] + include: /(ethereumjs-tx)/, + loaders: [ 'happypack/loader?id=babel' ] } ] }, From a534949b2dbed28e6365caf674ab3c4c1a39222f Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Fri, 25 Nov 2016 17:33:18 +0100 Subject: [PATCH 08/38] Updated packages version... --- js/package.json | 56 ++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/js/package.json b/js/package.json index 28d2ce748..168378bc3 100644 --- a/js/package.json +++ b/js/package.json @@ -47,52 +47,52 @@ "prepush": "npm run lint:cached" }, "devDependencies": { - "babel-cli": "~6.10.1", - "babel-core": "~6.10.4", + "babel-cli": "~6.18.0", + "babel-core": "~6.18.2", "babel-eslint": "~7.1.0", "babel-loader": "~6.2.3", "babel-plugin-lodash": "~3.2.2", - "babel-plugin-transform-class-properties": "~6.11.5", + "babel-plugin-transform-class-properties": "~6.19.0", "babel-plugin-transform-decorators-legacy": "~1.3.4", "babel-plugin-transform-react-remove-prop-types": "~0.2.9", - "babel-plugin-transform-runtime": "~6.9.0", - "babel-polyfill": "~6.13.0", - "babel-preset-es2015": "~6.9.0", - "babel-preset-es2015-rollup": "~1.1.1", - "babel-preset-es2016": "~6.11.3", - "babel-preset-es2017": "~6.14.0", - "babel-preset-react": "~6.5.0", - "babel-preset-stage-0": "~6.5.0", - "babel-register": "6.9.0", - "babel-runtime": "~6.9.2", + "babel-plugin-transform-runtime": "~6.15.0", + "babel-polyfill": "~6.16.0", + "babel-preset-es2015": "~6.18.0", + "babel-preset-es2015-rollup": "~1.2.0", + "babel-preset-es2016": "~6.16.0", + "babel-preset-es2017": "~6.16.0", + "babel-preset-react": "~6.16.0", + "babel-preset-stage-0": "~6.16.0", + "babel-register": "6.18.0", + "babel-runtime": "~6.18.0", "chai": "~3.5.0", "chai-enzyme": "0.4.2", "cheerio": "0.20.0", "copy-webpack-plugin": "~4.0.0", "core-js": "~2.4.1", "coveralls": "~2.11.11", - "css-loader": "~0.23.1", + "css-loader": "~0.26.0", "enzyme": "2.3.0", - "eslint": "~3.1.0", - "eslint-config-semistandard": "~6.0.2", - "eslint-config-standard": "~5.3.5", - "eslint-config-standard-react": "~3.0.0", - "eslint-plugin-promise": "~2.0.0", - "eslint-plugin-react": "~5.1.1", + "eslint": "~3.10.2", + "eslint-config-semistandard": "~7.0.0", + "eslint-config-standard": "~6.2.1", + "eslint-config-standard-react": "~4.2.0", + "eslint-plugin-promise": "~3.4.0", + "eslint-plugin-react": "~6.7.1", "eslint-plugin-standard": "~2.0.0", "express": "~4.14.0", - "extract-loader": "0.0.2", - "extract-text-webpack-plugin": "~1.0.1", - "file-loader": "~0.8.5", + "extract-loader": "0.1.0", + "extract-text-webpack-plugin": "~2.0.0-beta.4", + "file-loader": "~0.9.0", "fs-extra": "~0.30.0", - "happypack": "~2.2.1", + "happypack": "~3.0.0", "history": "~2.0.0", "html-loader": "~0.4.4", "html-webpack-plugin": "~2.24.1", "http-proxy-middleware": "~0.17.2", "husky": "~0.11.9", "ignore-styles": "2.0.0", - "image-webpack-loader": "~1.8.0", + "image-webpack-loader": "~3.0.0", "istanbul": "~1.0.0-alpha.2", "jsdom": "9.2.1", "json-loader": "~0.5.4", @@ -101,13 +101,12 @@ "mock-socket": "~3.0.1", "nock": "~8.0.0", "postcss-import": "~8.1.2", - "postcss-loader": "~0.8.1", + "postcss-loader": "~1.1.1", "postcss-nested": "~1.0.0", "postcss-simple-vars": "~3.0.0", "raw-loader": "~0.5.1", "react-addons-perf": "~15.3.2", "react-addons-test-utils": "~15.3.2", - "react-copy-to-clipboard": "~4.2.3", "react-dom": "~15.3.2", "react-hot-loader": "~1.3.0", "rucksack-css": "~0.8.6", @@ -116,7 +115,7 @@ "sinon-chai": "~2.8.0", "style-loader": "~0.13.0", "url-loader": "~0.5.7", - "webpack": "~1.13.2", + "webpack": "~2.1.0-beta.27", "webpack-dev-middleware": "~1.8.4", "webpack-error-notification": "0.1.6", "webpack-hot-middleware": "~2.13.2", @@ -151,6 +150,7 @@ "react-ace": "~4.0.0", "react-addons-css-transition-group": "~15.3.2", "react-chartjs-2": "~1.5.0", + "react-copy-to-clipboard": "~4.2.3", "react-dom": "~15.3.2", "react-dropzone": "~3.7.3", "react-redux": "~4.4.5", From 83920908617952175c690fc615b578efe26ca1be Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Fri, 25 Nov 2016 19:32:58 +0100 Subject: [PATCH 09/38] WIP - Webpack 2 building --- js/.babelrc | 6 +- js/package.json | 3 +- js/src/contracts/contracts.js | 2 +- .../views/WriteContract/writeContractStore.js | 6 +- js/webpack/config.js | 59 ++++++------ js/webpack/dev.server.js | 7 ++ js/webpack/libraries.js | 14 ++- js/webpack/npm.js | 18 ++-- js/webpack/shared.js | 90 ++++++++++--------- js/webpack/vendor.js | 6 +- 10 files changed, 126 insertions(+), 85 deletions(-) diff --git a/js/.babelrc b/js/.babelrc index 27c697885..5c99af2ea 100644 --- a/js/.babelrc +++ b/js/.babelrc @@ -1,5 +1,9 @@ { - "presets": ["es2017", "es2016", "es2015", "stage-0", "react"], + "presets": [ + "es2017", "es2016", + [ "es2015", { "modules": false } ], + "stage-0", "react" + ], "plugins": [ "transform-runtime", "transform-decorators-legacy", diff --git a/js/package.json b/js/package.json index 168378bc3..ad944dc85 100644 --- a/js/package.json +++ b/js/package.json @@ -100,10 +100,11 @@ "mock-local-storage": "1.0.2", "mock-socket": "~3.0.1", "nock": "~8.0.0", - "postcss-import": "~8.1.2", + "postcss-import": "8.1.0", "postcss-loader": "~1.1.1", "postcss-nested": "~1.0.0", "postcss-simple-vars": "~3.0.0", + "progress": "^1.1.8", "raw-loader": "~0.5.1", "react-addons-perf": "~15.3.2", "react-addons-test-utils": "~15.3.2", diff --git a/js/src/contracts/contracts.js b/js/src/contracts/contracts.js index 9d745762c..cefece7de 100644 --- a/js/src/contracts/contracts.js +++ b/js/src/contracts/contracts.js @@ -19,7 +19,7 @@ import Registry from './registry'; import SignatureReg from './signaturereg'; import TokenReg from './tokenreg'; import GithubHint from './githubhint'; -import smsVerification from './sms-verification'; +import * as smsVerification from './sms-verification'; let instance = null; diff --git a/js/src/views/WriteContract/writeContractStore.js b/js/src/views/WriteContract/writeContractStore.js index e057bc38e..a9f59aafb 100644 --- a/js/src/views/WriteContract/writeContractStore.js +++ b/js/src/views/WriteContract/writeContractStore.js @@ -24,17 +24,17 @@ const SNIPPETS = { snippet0: { name: 'Token.sol', description: 'Standard ERP20 Token Contract', - id: 'snippet0', sourcecode: require('raw!../../contracts/snippets/token.sol') + id: 'snippet0', sourcecode: require('raw-loader!../../contracts/snippets/token.sol') }, snippet1: { name: 'StandardToken.sol', description: 'Implementation of ERP20 Token Contract', - id: 'snippet1', sourcecode: require('raw!../../contracts/snippets/standard-token.sol') + id: 'snippet1', sourcecode: require('raw-loader!../../contracts/snippets/standard-token.sol') }, snippet2: { name: 'HumanStandardToken.sol', description: 'Implementation of the Human Token Contract', - id: 'snippet2', sourcecode: require('raw!../../contracts/snippets/human-standard-token.sol') + id: 'snippet2', sourcecode: require('raw-loader!../../contracts/snippets/human-standard-token.sol') } }; diff --git a/js/webpack/config.js b/js/webpack/config.js index 814c731a3..11a51cee0 100644 --- a/js/webpack/config.js +++ b/js/webpack/config.js @@ -31,7 +31,6 @@ const ENV = process.env.NODE_ENV || 'development'; const isProd = ENV === 'production'; module.exports = { - debug: !isProd, cache: !isProd, devtool: isProd ? '#eval' : '#cheap-module-eval-source-map', @@ -46,43 +45,61 @@ module.exports = { }, module: { - loaders: [ + rules: [ { test: /\.js$/, exclude: /node_modules/, - loaders: [ 'happypack/loader?id=js' ] + // use: [ 'happypack/loader?id=js' ] + use: isProd ? ['babel-loader'] : [ + // 'react-hot-loader', + 'babel-loader?cacheDirectory=true' + ] }, { test: /\.js$/, include: /node_modules\/material-ui-chip-input/, - loader: 'babel' + use: [ 'babel-loader' ] }, { test: /\.json$/, - loaders: ['json'] + use: [ 'json-loader' ] }, { test: /\.html$/, - loader: 'file?name=[name].[ext]!extract-loader!html-loader' + use: [ + 'file-loader?name=[name].[ext]!extract-loader', + { + loader: 'html-loader', + options: { + root: path.resolve(__dirname, '../assets/images'), + attrs: ['img:src', 'link:href'] + } + } + ] }, { test: /\.css$/, - include: [/src/], - loaders: [ 'happypack/loader?id=css' ] + include: [ /src/ ], + // use: [ 'happypack/loader?id=css' ] + use: [ + 'style-loader', + 'css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]', + 'postcss-loader' + ] }, { test: /\.css$/, - exclude: [/src/], - loader: 'style!css' + exclude: [ /src/ ], + use: [ 'style-loader', 'css-loader' ] }, { test: /\.(png|jpg)$/, - loader: 'file-loader?name=[name].[hash].[ext]' + use: [ 'file-loader?name=[name].[hash].[ext]' ] }, { test: /\.(woff(2)|ttf|eot|svg|otf)(\?v=[0-9]\.[0-9]\.[0-9])?$/, - loader: 'file-loader' + use: [ 'file-loader' ] } ], noParse: [ @@ -91,22 +108,12 @@ module.exports = { }, resolve: { - root: path.join(__dirname, '../node_modules'), - fallback: path.join(__dirname, '../node_modules'), - extensions: ['', '.js', '.jsx'], + modules: [ + path.join(__dirname, '../node_modules') + ], + extensions: ['.json', '.js', '.jsx'], unsafeCache: true }, - resolveLoaders: { - root: path.join(__dirname, '../node_modules'), - fallback: path.join(__dirname, '../node_modules') - }, - - htmlLoader: { - root: path.resolve(__dirname, '../assets/images'), - attrs: ['img:src', 'link:href'] - }, - - postcss: Shared.postcss, plugins: (function () { const plugins = Shared.getPlugins().concat([ diff --git a/js/webpack/dev.server.js b/js/webpack/dev.server.js index 7ebdd815e..2ae3fe0f7 100644 --- a/js/webpack/dev.server.js +++ b/js/webpack/dev.server.js @@ -20,11 +20,13 @@ const webpackHotMiddleware = require('webpack-hot-middleware'); const http = require('http'); const express = require('express'); +const ProgressBar = require('progress'); const webpackConfig = require('./config'); const Shared = require('./shared'); const hotMiddlewareScript = 'webpack-hot-middleware/client'; +let progressBar = { update: () => {} }; /** * Add webpack hot middleware to each entry in the config @@ -39,6 +41,9 @@ const hotMiddlewareScript = 'webpack-hot-middleware/client'; webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin()); webpackConfig.plugins.push(new webpack.NoErrorsPlugin()); + webpackConfig.plugins.push(new webpack.ProgressPlugin( + (percentage) => progressBar.update(percentage) + )); })(); const app = express(); @@ -47,6 +52,7 @@ const compiler = webpack(webpackConfig); app.use(webpackDevMiddleware(compiler, { noInfo: false, quiet: false, + progress: true, publicPath: webpackConfig.output.publicPath, stats: { colors: true @@ -65,4 +71,5 @@ Shared.addProxies(app); const server = http.createServer(app); server.listen(process.env.PORT || 3000, function () { console.log('Listening on port', server.address().port); + progressBar = new ProgressBar('[:bar] :percent :etas', { total: 50 }); }); diff --git a/js/webpack/libraries.js b/js/webpack/libraries.js index 6494b6d0a..d1a2b4915 100644 --- a/js/webpack/libraries.js +++ b/js/webpack/libraries.js @@ -21,6 +21,8 @@ const path = require('path'); const Shared = require('./shared'); const DEST = process.env.BUILD_DEST || '.build'; +const ENV = process.env.NODE_ENV || 'development'; +const isProd = ENV === 'production'; module.exports = { context: path.join(__dirname, '../src'), @@ -37,19 +39,23 @@ module.exports = { libraryTarget: 'umd' }, module: { - loaders: [ + rules: [ { test: /\.js$/, exclude: /node_modules/, - loader: 'happypack/loader?id=js' + // use: [ 'happypack/loader?id=js' ] + use: isProd ? ['babel-loader'] : [ + // 'react-hot-loader', + 'babel-loader?cacheDirectory=true' + ] }, { test: /\.json$/, - loaders: ['json'] + use: [ 'json-loader' ] }, { test: /\.html$/, - loader: 'file?name=[name].[ext]' + use: [ 'file-loader?name=[name].[ext]' ] } ] }, diff --git a/js/webpack/npm.js b/js/webpack/npm.js index a3ede06f0..7353efe55 100644 --- a/js/webpack/npm.js +++ b/js/webpack/npm.js @@ -15,7 +15,6 @@ // along with Parity. If not, see . const path = require('path'); -const webpack = require('webpack'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const packageJson = require('../package.json'); @@ -43,18 +42,27 @@ module.exports = { noParse: [ /babel-polyfill/ ], - loaders: [ + rules: [ { test: /(\.jsx|\.js)$/, - loaders: [ 'happypack/loader?id=js' ], + // use: [ 'happypack/loader?id=js' ], + use: isProd ? ['babel-loader'] : [ + // 'react-hot-loader', + 'babel-loader?cacheDirectory=true' + ], exclude: /node_modules/ } ] }, + resolve: { - root: path.resolve('./src'), - extensions: ['', '.js'] + modules: [ + path.resolve('./src'), + path.join(__dirname, '../node_modules') + ], + extensions: ['.json', '.js', '.jsx'] }, + plugins: Shared.getPlugins().concat([ new CopyWebpackPlugin([ { diff --git a/js/webpack/shared.js b/js/webpack/shared.js index 0fe3d3275..19c3cd770 100644 --- a/js/webpack/shared.js +++ b/js/webpack/shared.js @@ -15,7 +15,8 @@ // along with Parity. If not, see . const webpack = require('webpack'); -const HappyPack = require('happypack'); +const path = require('path'); +// const HappyPack = require('happypack'); const postcssImport = require('postcss-import'); const postcssNested = require('postcss-nested'); @@ -26,31 +27,46 @@ const ENV = process.env.NODE_ENV || 'development'; const isProd = ENV === 'production'; function getPlugins (_isProd = isProd) { + const postcss = [ + postcssImport({ + addDependencyTo: webpack + }), + postcssNested({}), + postcssVars({ + unknown: function (node, name, result) { + node.warn(result, `Unknown variable ${name}`); + } + }), + rucksack({ + autoprefixer: true + }) + ]; + const plugins = [ - new HappyPack({ - id: 'css', - threads: 4, - loaders: [ - 'style', - 'css?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]', - 'postcss' - ] - }), + // new HappyPack({ + // id: 'css', + // threads: 4, + // loaders: [ + // 'style-loader', + // 'css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]', + // 'postcss-loader' + // ] + // }), - new HappyPack({ - id: 'js', - threads: 4, - loaders: _isProd ? ['babel'] : [ - 'react-hot', - 'babel?cacheDirectory=true' - ] - }), + // new HappyPack({ + // id: 'js', + // threads: 4, + // loaders: _isProd ? ['babel'] : [ + // 'react-hot-loader', + // 'babel-loader?cacheDirectory=true' + // ] + // }), - new HappyPack({ - id: 'babel', - threads: 4, - loaders: ['babel'] - }), + // new HappyPack({ + // id: 'babel', + // threads: 4, + // loaders: ['babel-loader'] + // }), new webpack.DefinePlugin({ 'process.env': { @@ -62,11 +78,19 @@ function getPlugins (_isProd = isProd) { } }), + new webpack.LoaderOptionsPlugin({ + minimize: isProd, + debug: !isProd, + options: { + context: path.join(__dirname, '../src'), + postcss: postcss + } + }), + new webpack.optimize.OccurrenceOrderPlugin(!_isProd) ]; if (_isProd) { - plugins.push(new webpack.optimize.DedupePlugin()); plugins.push(new webpack.optimize.UglifyJsPlugin({ screwIe8: true, compress: { @@ -90,21 +114,6 @@ function getDappsEntry () { }, {}); } -const postcss = [ - postcssImport({ - addDependencyTo: webpack - }), - postcssNested({}), - postcssVars({ - unknown: function (node, name, result) { - node.warn(result, `Unknown variable ${name}`); - } - }), - rucksack({ - autoprefixer: true - }) -]; - function addProxies (app) { const proxy = require('http-proxy-middleware'); @@ -147,6 +156,5 @@ function addProxies (app) { module.exports = { getPlugins: getPlugins, dappsEntry: getDappsEntry(), - addProxies: addProxies, - postcss: postcss + addProxies: addProxies }; diff --git a/js/webpack/vendor.js b/js/webpack/vendor.js index c7efe3edf..dfef25464 100644 --- a/js/webpack/vendor.js +++ b/js/webpack/vendor.js @@ -51,15 +51,15 @@ module.exports = { vendor: modules }, module: { - loaders: [ + rules: [ { test: /\.json$/, - loaders: ['json'] + use: [ 'json-loader' ] }, { test: /\.js$/, include: /(ethereumjs-tx)/, - loaders: [ 'happypack/loader?id=babel' ] + use: [ 'babel-loader' ] } ] }, From f77afd072bb8a91a0628a3b32353d2379f47dd74 Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Fri, 25 Nov 2016 19:48:06 +0100 Subject: [PATCH 10/38] Updated ESLINT and fixing linting issues --- js/.eslintrc.json | 3 ++- .../dapps/localtx/Application/application.js | 24 +++++++++---------- .../dapps/localtx/Transaction/transaction.js | 9 ++++--- js/src/dapps/signaturereg/Import/import.js | 2 +- js/src/dapps/tokenreg.js | 6 ++--- js/src/dapps/tokenreg/Tokens/actions.js | 2 +- js/src/modals/LoadContract/loadContract.js | 24 +++++++++---------- .../modals/PasswordManager/passwordManager.js | 8 +++---- .../modals/SMSVerification/SMSVerification.js | 2 +- js/src/ui/Container/Title/title.js | 6 ++--- js/src/ui/Tooltips/Tooltip/tooltip.js | 8 +++---- js/src/views/Accounts/accounts.js | 2 +- js/src/views/Application/TabBar/tabBar.js | 4 ++-- js/src/views/Dapp/dapp.js | 3 +-- js/src/views/Dapps/AddDapps/AddDapps.js | 3 +-- .../TransactionPendingForm.js | 2 +- js/src/views/Status/components/Calls/Calls.js | 2 +- .../components/EditableValue/EditableValue.js | 8 +++---- .../components/JsonEditor/JsonEditor.js | 2 +- .../Status/components/RpcCalls/RpcCalls.js | 2 +- .../Status/components/RpcDocs/RpcDocs.js | 2 +- .../views/Status/components/RpcNav/RpcNav.js | 4 ++-- js/src/views/WriteContract/writeContract.js | 3 +-- 23 files changed, 64 insertions(+), 67 deletions(-) diff --git a/js/.eslintrc.json b/js/.eslintrc.json index b649a1bea..198750580 100644 --- a/js/.eslintrc.json +++ b/js/.eslintrc.json @@ -15,6 +15,7 @@ "no-debugger": "error", "no-alert": "error", "jsx-quotes": ["error", "prefer-single"], - "react/jsx-curly-spacing": ["error", "always"] + "react/jsx-curly-spacing": ["error", "always"], + "object-property-newline": 0 } } diff --git a/js/src/dapps/localtx/Application/application.js b/js/src/dapps/localtx/Application/application.js index 7d220611f..da435b57d 100644 --- a/js/src/dapps/localtx/Application/application.js +++ b/js/src/dapps/localtx/Application/application.js @@ -158,18 +158,18 @@ export default class Application extends Component { { Transaction.renderHeader() } - { - transactions.map((tx, idx) => ( - - )) - } + { + transactions.map((tx, idx) => ( + + )) + } ); diff --git a/js/src/dapps/localtx/Transaction/transaction.js b/js/src/dapps/localtx/Transaction/transaction.js index 90981304b..17a45ecd6 100644 --- a/js/src/dapps/localtx/Transaction/transaction.js +++ b/js/src/dapps/localtx/Transaction/transaction.js @@ -83,7 +83,7 @@ class BaseTransaction extends Component { return ( - { noOfPropagations } ({ noOfPeers } peers) + { noOfPropagations } ({ noOfPeers } peers) ); } @@ -110,7 +110,7 @@ export class Transaction extends BaseTransaction { static renderHeader () { return ( - + Transaction @@ -129,8 +129,7 @@ export class Transaction extends BaseTransaction { # Propagated - - + ); } @@ -201,7 +200,7 @@ export class LocalTransaction extends BaseTransaction { static renderHeader () { return ( - + Transaction diff --git a/js/src/dapps/signaturereg/Import/import.js b/js/src/dapps/signaturereg/Import/import.js index 90edf9415..55f7d9334 100644 --- a/js/src/dapps/signaturereg/Import/import.js +++ b/js/src/dapps/signaturereg/Import/import.js @@ -73,7 +73,7 @@ export default class Import extends Component { Provide the ABI (Contract Interface) in the space provided below. Only non-constant functions (names & types) will be imported, while constant functions and existing signatures will be ignored.
- +