diff --git a/js/package-lock.json b/js/package-lock.json index 81050e1c7..df6abaa37 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -668,10 +668,13 @@ "dev": true }, "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", + "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", + "dev": true, + "requires": { + "lodash": "4.17.2" + } }, "async-each": { "version": "1.0.1", @@ -5685,28 +5688,15 @@ } }, "extract-text-webpack-plugin": { - "version": "2.0.0-beta.4", - "resolved": "https://registry.npmjs.org/extract-text-webpack-plugin/-/extract-text-webpack-plugin-2.0.0-beta.4.tgz", - "integrity": "sha1-0yOTBp59kMgxjUg5IwJhi1a8G6k=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/extract-text-webpack-plugin/-/extract-text-webpack-plugin-3.0.0.tgz", + "integrity": "sha1-kMqnkHvESfM1AF46x1MrQbAN5hI=", "dev": true, "requires": { - "async": "1.5.2", - "loader-utils": "0.2.17", - "webpack-sources": "0.1.5" - }, - "dependencies": { - "loader-utils": { - "version": "0.2.17", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.17.tgz", - "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", - "dev": true, - "requires": { - "big.js": "3.1.3", - "emojis-list": "2.1.0", - "json5": "0.5.1", - "object-assign": "4.1.1" - } - } + "async": "2.5.0", + "loader-utils": "1.1.0", + "schema-utils": "0.3.0", + "webpack-sources": "1.0.1" } }, "extsprintf": { @@ -7553,6 +7543,12 @@ "uglify-js": "2.8.22" }, "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, "source-map": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", @@ -8750,6 +8746,14 @@ "nopt": "3.0.6", "which": "1.2.14", "wordwrap": "1.0.0" + }, + "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + } } }, "istanbul-api": { @@ -8771,15 +8775,6 @@ "once": "1.4.0" }, "dependencies": { - "async": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", - "dev": true, - "requires": { - "lodash": "4.17.2" - } - }, "esprima": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", @@ -9288,6 +9283,12 @@ "color-convert": "1.9.0" } }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, "camelcase": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", @@ -9799,6 +9800,12 @@ "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=", "dev": true }, + "lodash.endswith": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lodash.endswith/-/lodash.endswith-4.2.1.tgz", + "integrity": "sha1-/tWawXOO0+I27dcGTsRWRIs3vAk=", + "dev": true + }, "lodash.escape": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", @@ -11006,6 +11013,58 @@ "integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=", "dev": true }, + "parallel-webpack": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/parallel-webpack/-/parallel-webpack-2.1.0.tgz", + "integrity": "sha1-+IezvJ8EfLsL2JSosJr7aQRGAoc=", + "dev": true, + "requires": { + "ajv": "4.11.8", + "bluebird": "3.5.0", + "chalk": "1.1.3", + "interpret": "1.0.3", + "lodash.assign": "4.2.0", + "lodash.endswith": "4.2.1", + "lodash.flatten": "4.4.0", + "minimist": "1.2.0", + "pluralize": "1.2.1", + "supports-color": "3.2.3", + "worker-farm": "1.4.1" + }, + "dependencies": { + "ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "dev": true, + "requires": { + "co": "4.6.0", + "json-stable-stringify": "1.0.1" + } + }, + "bluebird": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz", + "integrity": "sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw=", + "dev": true + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, + "requires": { + "has-flag": "1.0.0" + } + } + } + }, "param-case": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz", @@ -12192,17 +12251,6 @@ "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", "dev": true }, - "progress-bar-webpack-plugin": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/progress-bar-webpack-plugin/-/progress-bar-webpack-plugin-1.9.3.tgz", - "integrity": "sha1-gfuL2OONpu2vmiC+7Xm9l43WPCo=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "object.assign": "4.0.4", - "progress": "1.1.8" - } - }, "promise": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", @@ -14881,87 +14929,6 @@ "dev": true, "optional": true }, - "uglifyjs-webpack-plugin": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-0.4.6.tgz", - "integrity": "sha1-uVH0q7a9YX5m9j64kUmOORdj4wk=", - "dev": true, - "requires": { - "source-map": "0.5.6", - "uglify-js": "2.8.29", - "webpack-sources": "1.0.1" - }, - "dependencies": { - "camelcase": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", - "dev": true - }, - "cliui": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", - "dev": true, - "requires": { - "center-align": "0.1.3", - "right-align": "0.1.3", - "wordwrap": "0.0.2" - } - }, - "source-list-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz", - "integrity": "sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==", - "dev": true - }, - "uglify-js": { - "version": "2.8.29", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", - "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", - "dev": true, - "requires": { - "source-map": "0.5.6", - "uglify-to-browserify": "1.0.2", - "yargs": "3.10.0" - } - }, - "webpack-sources": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.0.1.tgz", - "integrity": "sha512-05tMxipUCwHqYaVS8xc7sYPTly8PzXayRCB4dTxLhWTqlKUiwH6ezmEe0OSreL1c30LAuA3Zqmc+uEBUGFJDjw==", - "dev": true, - "requires": { - "source-list-map": "2.0.0", - "source-map": "0.5.6" - } - }, - "window-size": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", - "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", - "dev": true - }, - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true - }, - "yargs": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", - "dev": true, - "requires": { - "camelcase": "1.2.1", - "cliui": "2.1.0", - "decamelize": "1.2.0", - "window-size": "0.1.0" - } - } - } - }, "uniq": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", @@ -15299,17 +15266,6 @@ "async": "2.5.0", "chokidar": "1.7.0", "graceful-fs": "4.1.11" - }, - "dependencies": { - "async": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", - "dev": true, - "requires": { - "lodash": "4.17.2" - } - } } }, "wcwidth": { @@ -15344,54 +15300,60 @@ "dev": true }, "webpack": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.3.0.tgz", - "integrity": "sha1-zi+eB2Vmq6kfdIhxM6iD/X2hh7w=", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-2.4.1.tgz", + "integrity": "sha1-FakdvjSWbYpLmcfWVu/ZKi5ab2o=", "dev": true, "requires": { "acorn": "5.1.1", "acorn-dynamic-import": "2.0.2", - "ajv": "5.2.2", - "ajv-keywords": "2.1.0", + "ajv": "4.11.8", + "ajv-keywords": "1.5.1", "async": "2.5.0", "enhanced-resolve": "3.4.1", - "escope": "3.6.0", "interpret": "1.0.3", "json-loader": "0.5.4", "json5": "0.5.1", "loader-runner": "2.3.0", - "loader-utils": "1.1.0", + "loader-utils": "0.2.17", "memory-fs": "0.4.1", "mkdirp": "0.5.1", "node-libs-browser": "2.0.0", "source-map": "0.5.6", "supports-color": "3.2.3", "tapable": "0.2.7", - "uglifyjs-webpack-plugin": "0.4.6", + "uglify-js": "2.8.22", "watchpack": "1.4.0", - "webpack-sources": "1.0.1", + "webpack-sources": "0.2.3", "yargs": "6.6.0" }, "dependencies": { - "ajv-keywords": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.0.tgz", - "integrity": "sha1-opbhf3v658HOT34N5T0pyzIWLfA=", - "dev": true - }, - "async": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", + "ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", "dev": true, "requires": { - "lodash": "4.17.2" + "co": "4.6.0", + "json-stable-stringify": "1.0.1" + } + }, + "loader-utils": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.17.tgz", + "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", + "dev": true, + "requires": { + "big.js": "3.1.3", + "emojis-list": "2.1.0", + "json5": "0.5.1", + "object-assign": "4.1.1" } }, "source-list-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz", - "integrity": "sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-1.1.2.tgz", + "integrity": "sha1-mIkBnRAkzOVc3AaUmDN+9hhqEaE=", "dev": true }, "supports-color": { @@ -15404,12 +15366,12 @@ } }, "webpack-sources": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.0.1.tgz", - "integrity": "sha512-05tMxipUCwHqYaVS8xc7sYPTly8PzXayRCB4dTxLhWTqlKUiwH6ezmEe0OSreL1c30LAuA3Zqmc+uEBUGFJDjw==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-0.2.3.tgz", + "integrity": "sha1-F8Yr+vE8cH+dAsR54Nzd6DgGl/s=", "dev": true, "requires": { - "source-list-map": "2.0.0", + "source-list-map": "1.1.2", "source-map": "0.5.6" } } @@ -15457,13 +15419,21 @@ } }, "webpack-sources": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-0.1.5.tgz", - "integrity": "sha1-qh86vw8NdNtxEcQOUAuE+WZkB1A=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.0.1.tgz", + "integrity": "sha512-05tMxipUCwHqYaVS8xc7sYPTly8PzXayRCB4dTxLhWTqlKUiwH6ezmEe0OSreL1c30LAuA3Zqmc+uEBUGFJDjw==", "dev": true, "requires": { - "source-list-map": "0.1.8", + "source-list-map": "2.0.0", "source-map": "0.5.6" + }, + "dependencies": { + "source-list-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz", + "integrity": "sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==", + "dev": true + } } }, "webrtc-adapter": { @@ -15565,6 +15535,16 @@ "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", "dev": true }, + "worker-farm": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.4.1.tgz", + "integrity": "sha512-tgFAtgOYLPutkAyzgpS6VJFL5HY+0ui1Tvua+fITgz8ByaJTMFGtazR6xxQfwfiAcbwE+2fLG/K49wc2TfwCNw==", + "dev": true, + "requires": { + "errno": "0.1.4", + "xtend": "4.0.1" + } + }, "worker-loader": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-0.8.1.tgz", diff --git a/js/package.json b/js/package.json index 5b392f70a..79557c22a 100644 --- a/js/package.json +++ b/js/package.json @@ -26,23 +26,20 @@ "Promise" ], "scripts": { - "analize": "npm run analize:lib && npm run analize:dll && npm run analize:app", - "analize:app": "WPANALIZE=1 webpack --config webpack/app --json > .build/analize.app.json && cat .build/analize.app.json | webpack-bundle-size-analyzer", - "analize:lib": "WPANALIZE=1 webpack --config webpack/libraries --json > .build/analize.lib.json && cat .build/analize.lib.json | webpack-bundle-size-analyzer", "build": "npm run build:lib && npm run build:app && npm run build:embed", - "build:app": "webpack --config webpack/app", - "build:lib": "webpack --config webpack/libraries", + "build:app": "parallel-webpack -p=4 --config webpack/app", + "build:lib": "parallel-webpack -p=4 --config webpack/libraries", "build:markdown": "babel-node ./scripts/build-rpc-markdown.js", "build:json": "babel-node ./scripts/build-rpc-json.js", "build:embed": "EMBED=1 node webpack/embed", "build:i18n": "npm run clean && npm run build && babel-node ./scripts/build-i18n.js", "ci:build": "npm run ci:build:lib && npm run ci:build:app && npm run ci:build:embed", - "ci:build:app": "NODE_ENV=production webpack --config webpack/app", - "ci:build:lib": "NODE_ENV=production webpack --config webpack/libraries", - "ci:build:npm": "NODE_ENV=production webpack --config webpack/npm", + "ci:build:app": "NODE_ENV=production parallel-webpack -p=4 --config webpack/app", + "ci:build:lib": "NODE_ENV=production parallel-webpack -p=4 --config webpack/libraries", + "ci:build:npm": "NODE_ENV=production parallel-webpack -p=4 --config webpack/npm", "ci:build:jsonrpc": "babel-node ./scripts/build-rpc-json.js --output .npmjs/jsonrpc", "ci:build:embed": "NODE_ENV=production EMBED=1 node webpack/embed", - "clean": "rm -rf ./.build ./.coverage ./.happypack ./.npmjs ./build ./node_modules/.cache ./node_modules/@parity", + "clean": "rm -rf ./.build ./.coverage ./build ./node_modules/.cache", "coveralls": "npm run testCoverage && coveralls < coverage/lcov.info", "lint": "npm run lint:css && npm run lint:js", "lint:cached": "npm run lint:css && npm run lint:js:cached", @@ -53,7 +50,7 @@ "lint:js:cached": "eslint --cache --ignore-path .gitignore ./src/", "lint:js:fix": "eslint --fix --ignore-path .gitignore ./src/", "start": "npm run clean && npm install && npm run build:lib && npm run start:app", - "start:app": "node webpack/dev.server", + "start:app": "webpack-dev-server --config webpack/app", "test": "NODE_ENV=test mocha --compilers ejs:ejsify 'src/**/*.spec.js' 'packages/**/*.spec.js'", "test:coverage": "NODE_ENV=test istanbul cover _mocha -- --compilers ejs:ejsify 'src/**/*.spec.js' 'packages/**/*.spec.js'", "test:e2e": "NODE_ENV=test mocha 'src/**/*.e2e.js' 'packages/**/*.e2e.js'", @@ -106,7 +103,7 @@ "eslint-plugin-standard": "2.0.1", "express": "4.14.1", "extract-loader": "0.1.0", - "extract-text-webpack-plugin": "2.0.0-beta.4", + "extract-text-webpack-plugin": "3.0.0", "file-loader": "0.10.0", "flow-bin": "^0.46.0", "happypack": "3.0.3", @@ -125,12 +122,12 @@ "mock-local-storage": "1.0.2", "mock-socket": "6.0.4", "nock": "9.0.7", + "parallel-webpack": "2.1.0", "postcss-import": "10.0.0", "postcss-loader": "2.0.6", "postcss-nested": "2.1.0", "postcss-simple-vars": "4.0.0", "progress": "1.1.8", - "progress-bar-webpack-plugin": "1.9.3", "raw-loader": "0.5.1", "react-addons-perf": "15.4.2", "react-addons-test-utils": "15.4.2", @@ -147,7 +144,7 @@ "to-source": "2.0.3", "uglify-js": "2.8.22", "url-loader": "0.5.7", - "webpack": "3.3.0", + "webpack": "2.4.1", "webpack-bundle-size-analyzer": "2.5.0", "webpack-dev-middleware": "1.10.1", "webpack-error-notification": "0.1.6", diff --git a/js/src/Dapps/dapps.js b/js/src/Dapps/dapps.js index 693213baf..23097615e 100644 --- a/js/src/Dapps/dapps.js +++ b/js/src/Dapps/dapps.js @@ -27,8 +27,6 @@ import DappsStore from './dappsStore'; import styles from './dapps.css'; -console.log('styles', styles); - @observer class Dapps extends Component { static contextTypes = { diff --git a/js/webpack/app.js b/js/webpack/app.js index be1120ed0..c169c348d 100644 --- a/js/webpack/app.js +++ b/js/webpack/app.js @@ -17,7 +17,6 @@ const path = require('path'); // const ReactIntlAggregatePlugin = require('react-intl-aggregate-webpack-plugin'); -const ExtractTextPlugin = require('extract-text-webpack-plugin'); const WebpackErrorNotificationPlugin = require('webpack-error-notification'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); @@ -27,11 +26,11 @@ const rulesEs6 = require('./rules/es6'); const rulesParity = require('./rules/parity'); const Shared = require('./shared'); -const DAPPS_BUILTIN = []; // require('@parity/shared/config/dappsBuiltin.json'); -const DAPPS_VIEWS = []; // require('@parity/shared/config/dappsViews.json').map((dapp) => { -// dapp.commons = true; -// return dapp; -// }); +const DAPPS_BUILTIN = require('@parity/shared/config/dappsBuiltin.json'); +const DAPPS_VIEWS = require('@parity/shared/config/dappsViews.json').map((dapp) => { + dapp.commons = true; + return dapp; +}); const FAVICON = path.resolve(__dirname, '../node_modules/@parity/shared/assets/images/parity-logo-black-no-text.png'); @@ -41,7 +40,6 @@ const EMBED = process.env.EMBED; const isProd = ENV === 'production'; const isEmbed = EMBED === '1' || EMBED === 'true'; -// const isAnalize = process.env.WPANALIZE === '1'; const entry = isEmbed ? { @@ -51,211 +49,224 @@ const entry = isEmbed index: './index.js' }); -module.exports = { - cache: !isProd, - devtool: isProd ? '#hidden-source-map' : '#source-map', +module.exports = Object.keys(entry).map((entryName) => { + const entrySrc = entry[entryName]; - context: path.join(__dirname, '../src'), - entry: entry, - output: { - path: path.join(__dirname, '../', DEST), - filename: '[name].js' - }, + return { + cache: !isProd, + devtool: isProd ? '#hidden-source-map' : '#source-map', - module: { - rules: [ - rulesParity, - rulesEs6, - { - test: /\.js$/, - exclude: /(node_modules)/, - use: [ 'babel-loader' ] - }, - { - test: /\.json$/, - use: [ 'json-loader' ] - }, - { - test: /\.ejs$/, - use: [ 'ejs-loader' ] - }, - { - test: /\.html$/, - use: [ - { + context: path.join(__dirname, '../src'), + entry: { + [entryName]: entrySrc + }, + output: { + path: path.join(__dirname, '../', DEST), + filename: '[name].js' + }, + + module: { + rules: [ + rulesParity, + rulesEs6, + { + test: /\.js$/, + exclude: /(node_modules)/, + use: [ 'babel-loader' ] + }, + { + test: /\.json$/, + use: [ 'json-loader' ] + }, + { + test: /\.ejs$/, + use: [ 'ejs-loader' ] + }, + { + test: /\.html$/, + use: [ + { + loader: 'file-loader', + options: { + name: '[name].[ext]' + } + }, + 'extract-loader', + { + loader: 'html-loader', + options: { + root: path.resolve(__dirname, '../assets/images'), + attrs: ['img:src', 'link:href'] + } + } + ] + }, + { + test: /\.md$/, + use: [ 'html-loader', 'markdown-loader' ] + }, + { + test: /\.css$/, + include: /node_modules\/(?!@parity)*/, + use: [ 'style-loader', 'css-loader' ] + }, + { + test: /\.css$/, + exclude: /node_modules\/(?!@parity)*/, + use: [ + 'style-loader', + { + loader: 'css-loader', + options: { + importLoaders: 1, + localIdentName: '[name]_[local]_[hash:base64:10]', + minimize: true, + modules: true + } + }, + { + loader: 'postcss-loader', + options: { + plugins: (loader) => [ + require('postcss-import'), + require('postcss-nested'), + require('postcss-simple-vars') + ] + } + } + ] + }, + { + test: /\.(png|jpg)$/, + use: [ { loader: 'file-loader', options: { - name: '[name].[ext]' + name: 'assets/[name].[hash].[ext]' } - }, - 'extract-loader', - { - loader: 'html-loader', + } ] + }, + { + test: /\.(woff|woff2|ttf|eot|otf)(\?v=[0-9]\.[0-9]\.[0-9])?$/, + use: [ { + loader: 'file-loader', options: { - root: path.resolve(__dirname, '../assets/images'), - attrs: ['img:src', 'link:href'] + name: 'fonts/[name][hash].[ext]' } - } - ] - }, - { - test: /\.md$/, - use: [ 'html-loader', 'markdown-loader' ] - }, - { - test: /\.css$/, - use: [ - 'style-loader', - { - loader: 'css-loader', + } ] + }, + { + test: /parity-logo-white-no-text\.svg/, + use: [ 'url-loader' ] + }, + { + test: /\.svg(\?v=[0-9]\.[0-9]\.[0-9])?$/, + exclude: [ /parity-logo-white-no-text\.svg/ ], + use: [ { + loader: 'file-loader', options: { - importLoaders: 1 + name: 'assets/[name].[hash].[ext]' } - }, - { - loader: 'postcss-loader', - options: { - 'postcss-import': {}, - 'postcss-neted': {}, - 'postcss-simple-vars': {} - } - } - ] - }, - { - test: /\.(png|jpg)$/, - use: [ { - loader: 'file-loader', - options: { - name: 'assets/[name].[hash:10].[ext]' - } - } ] - }, - { - test: /\.(woff|woff2|ttf|eot|otf)(\?v=[0-9]\.[0-9]\.[0-9])?$/, - use: [ { - loader: 'file-loader', - options: { - name: 'fonts/[name][hash:10].[ext]' - } - } ] - }, - { - test: /parity-logo-white-no-text\.svg/, - use: [ 'url-loader' ] - }, - { - test: /\.svg(\?v=[0-9]\.[0-9]\.[0-9])?$/, - exclude: [ /parity-logo-white-no-text\.svg/ ], - use: [ { - loader: 'file-loader', - options: { - name: 'assets/[name].[hash:10].[ext]' - } - } ] - } - ], - noParse: [ - /node_modules\/sinon/ - ] - }, - - resolve: { - alias: { - '~': path.resolve(__dirname, '..'), - '@parity/abi': path.resolve(__dirname, '../node_modules/@parity/abi'), - '@parity/api': path.resolve(__dirname, '../node_modules/@parity/api'), - '@parity/etherscan': path.resolve(__dirname, '../node_modules/@parity/etherscan'), - '@parity/jsonrpc': path.resolve(__dirname, '../node_modules/@parity/jsonrpc'), - '@parity/parity.js': path.resolve(__dirname, '../node_modules/@parity/parity.js'), - '@parity/shared': path.resolve(__dirname, '../node_modules/@parity/shared'), - '@parity/ui': path.resolve(__dirname, '../node_modules/@parity/ui'), - '@parity/wordlist': path.resolve(__dirname, '../node_modules/@parity/wordlist'), - '@parity': path.resolve(__dirname, '../packages') + } ] + } + ], + noParse: [ + /node_modules\/sinon/ + ] }, - modules: [ - path.join(__dirname, '../node_modules') - ], - extensions: ['.json', '.js', '.jsx'], - unsafeCache: true - }, - node: { - fs: 'empty' - }, + resolve: { + alias: { + '~': path.resolve(__dirname, '..'), + '@parity/abi': path.resolve(__dirname, '../node_modules/@parity/abi'), + '@parity/api': path.resolve(__dirname, '../node_modules/@parity/api'), + '@parity/etherscan': path.resolve(__dirname, '../node_modules/@parity/etherscan'), + '@parity/jsonrpc': path.resolve(__dirname, '../node_modules/@parity/jsonrpc'), + '@parity/parity.js': path.resolve(__dirname, '../node_modules/@parity/parity.js'), + '@parity/shared': path.resolve(__dirname, '../node_modules/@parity/shared'), + '@parity/ui': path.resolve(__dirname, '../node_modules/@parity/ui'), + '@parity/wordlist': path.resolve(__dirname, '../node_modules/@parity/wordlist'), + '@parity': path.resolve(__dirname, '../packages') + }, + modules: [ + path.join(__dirname, '../node_modules') + ], + extensions: ['.json', '.js', '.jsx'], + unsafeCache: true + }, - plugins: (function () { - const DappsHTMLInjection = [] - .concat(DAPPS_BUILTIN, DAPPS_VIEWS) - .filter((dapp) => !dapp.skipBuild) - .map((dapp) => { - return new HtmlWebpackPlugin({ - title: dapp.name, - filename: dapp.url + '.html', - template: '../packages/dapps/index.ejs', - favicon: FAVICON, - secure: dapp.secure, - chunks: [ dapp.url ] + node: { + fs: 'empty' + }, + + plugins: (function () { + const DappsHTMLInjection = [] + .concat(DAPPS_BUILTIN, DAPPS_VIEWS) + .filter((dapp) => !dapp.skipBuild) + .map((dapp) => { + return new HtmlWebpackPlugin({ + title: dapp.name, + filename: dapp.url + '.html', + template: '../packages/dapps/index.ejs', + favicon: FAVICON, + secure: dapp.secure, + chunks: [ dapp.url ] + }); }); - }); - let plugins = Shared.getPlugins().concat( - new WebpackErrorNotificationPlugin(), - new ExtractTextPlugin({ - filename: 'styles/[name].[hash:10].css', - allChunks: true - }) - ); - - if (!isEmbed) { - plugins = [].concat( - plugins, - - new HtmlWebpackPlugin({ - title: 'Parity', - filename: 'index.html', - template: './index.ejs', - favicon: FAVICON, - chunks: [ 'index' ] - }), - - new ServiceWorkerWebpackPlugin({ - entry: path.join(__dirname, '../src/serviceWorker.js') - }), - - DappsHTMLInjection, - - new CopyWebpackPlugin([ - { from: './error_pages.css', to: 'styles.css' }, - { from: '../packages/dapps/static' } - ], {}) + let plugins = Shared.getPlugins().concat( + new WebpackErrorNotificationPlugin() ); - } - if (isEmbed) { - plugins.push( - new HtmlWebpackPlugin({ - title: 'Parity Bar', - filename: 'embed.html', - template: './index.ejs', - favicon: FAVICON, - chunks: [ 'embed' ] - }) - ); - } + if (!isEmbed) { + plugins = [].concat( + plugins, - // if (!isAnalize && !isProd) { - // const DEST_I18N = path.join(__dirname, '..', DEST, 'i18n'); - // - // plugins.push( - // new ReactIntlAggregatePlugin({ - // messagesPattern: DEST_I18N + '/i18n/**/*.json', - // aggregateOutputDir: DEST_I18N + '/i18n/', - // aggregateFilename: 'en' - // }) - // ); - // } + new HtmlWebpackPlugin({ + title: 'Parity', + filename: 'index.html', + template: './index.ejs', + favicon: FAVICON, + chunks: [ 'index' ] + }), - return plugins; - }()) -}; + new ServiceWorkerWebpackPlugin({ + entry: path.join(__dirname, '../src/serviceWorker.js') + }), + + DappsHTMLInjection, + + new CopyWebpackPlugin([ + { from: './error_pages.css', to: 'styles.css' }, + { from: '../packages/dapps/static' } + ], {}) + ); + } + + if (isEmbed) { + plugins.push( + new HtmlWebpackPlugin({ + title: 'Parity Bar', + filename: 'embed.html', + template: './index.ejs', + favicon: FAVICON, + chunks: [ 'embed' ] + }) + ); + } + + // if (!isAnalize && !isProd) { + // const DEST_I18N = path.join(__dirname, '..', DEST, 'i18n'); + // + // plugins.push( + // new ReactIntlAggregatePlugin({ + // messagesPattern: DEST_I18N + '/i18n/**/*.json', + // aggregateOutputDir: DEST_I18N + '/i18n/', + // aggregateFilename: 'en' + // }) + // ); + // } + + return plugins; + }()) + }; +}); diff --git a/js/webpack/build.server.js b/js/webpack/build.server.js deleted file mode 100644 index 486209ccb..000000000 --- a/js/webpack/build.server.js +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . -// test only -/** - * Run `DAPPS_URL="/" PARITY_URL="127.0.0.1:8546" 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) - */ - -var express = require('express'); - -var Shared = require('./shared'); - -var app = express(); - -Shared.addProxies(app); - -app.use(express.static('.build')); - -var server = app.listen(process.env.PORT || 3000, function () { - console.log('Listening on port', server.address().port); -}); diff --git a/js/webpack/dev.server.js b/js/webpack/dev.server.js deleted file mode 100644 index 07541a879..000000000 --- a/js/webpack/dev.server.js +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 WebpackStats = require('webpack/lib/Stats'); -const webpackDevMiddleware = require('webpack-dev-middleware'); -const webpackHotMiddleware = require('webpack-hot-middleware'); - -const http = require('http'); -const express = require('express'); -const ProgressBar = require('progress'); - -const webpackConfig = require('./app'); -const Shared = require('./shared'); - -let progressBar = { update: () => {} }; - -/** - * Add webpack hot middleware to each entry in the config - * and HMR to the plugins - */ -(function updateWebpackConfig () { - webpackConfig.performance = { hints: false }; - - Object.keys(webpackConfig.entry).forEach((key) => { - const entry = webpackConfig.entry[key]; - - webpackConfig.entry[key] = [].concat( - 'react-hot-loader/patch', - 'webpack-hot-middleware/client?reload=true', - entry - ); - }); - - webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin()); - webpackConfig.plugins.push(new webpack.NamedModulesPlugin()); - webpackConfig.plugins.push(new webpack.NoEmitOnErrorsPlugin()); - - webpackConfig.plugins.push(new webpack.ProgressPlugin( - (percentage) => progressBar.update(percentage) - )); -})(); - -const app = express(); -const compiler = webpack(webpackConfig); - -app.use(webpackHotMiddleware(compiler, { - log: console.log -})); - -app.use(webpackDevMiddleware(compiler, { - noInfo: true, - quiet: false, - progress: true, - publicPath: webpackConfig.output.publicPath, - stats: { - colors: true - }, - reporter: function (data) { - // @see https://github.com/webpack/webpack/blob/324d309107f00cfc38ec727521563d309339b2ec/lib/Stats.js#L790 - // Accepted values: none, errors-only, minimal, normal, verbose - const options = WebpackStats.presetToOptions('minimal'); - - options.timings = true; - - const output = data.stats.toString(options); - - process.stdout.write('\n'); - process.stdout.write(output); - process.stdout.write('\n\n'); - } -})); - -// Add the dev proxies in the express App -Shared.addProxies(app); - -app.use(express.static(webpackConfig.output.path)); - -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 6cdef103e..4297fd068 100644 --- a/js/webpack/libraries.js +++ b/js/webpack/libraries.js @@ -24,61 +24,61 @@ const Shared = require('./shared'); const DEST = process.env.BUILD_DEST || '.build'; -module.exports = { - context: path.join(__dirname, '../src'), - entry: { - 'inject': ['./inject.js'], - 'parity': ['./inject.js'], - 'web3': ['./inject.js'] - }, - output: { - path: path.join(__dirname, '../', DEST), - filename: '[name].js', - library: '[name].js', - libraryTarget: 'umd' - }, +module.exports = ['inject', 'parity', 'web3'].map((entryName) => { + return { + context: path.join(__dirname, '../src'), + entry: { + [entryName]: ['./inject.js'] + }, + output: { + path: path.join(__dirname, '../', DEST), + filename: '[name].js', + library: '[name].js', + libraryTarget: 'umd' + }, - resolve: { - alias: { - '~': path.resolve(__dirname, '..'), - '@parity/abi': path.resolve(__dirname, '../node_modules/@parity/abi'), - '@parity/api': path.resolve(__dirname, '../node_modules/@parity/api'), - '@parity/etherscan': path.resolve(__dirname, '../node_modules/@parity/etherscan'), - '@parity/jsonrpc': path.resolve(__dirname, '../node_modules/@parity/jsonrpc'), - '@parity/shared': path.resolve(__dirname, '../node_modules/@parity/shared'), - '@parity/ui': path.resolve(__dirname, '../node_modules/@parity/ui'), - '@parity/wordlist': path.resolve(__dirname, '../node_modules/@parity/wordlist'), - '@parity': path.resolve(__dirname, '../packages') - } - }, - - node: { - fs: 'empty' - }, - - module: { - rules: [ - rulesParity, - rulesEs6, - { - test: /\.js$/, - exclude: /node_modules/, - use: [ 'babel-loader' ] - }, - { - test: /\.json$/, - use: [ 'json-loader' ] - }, - { - test: /\.html$/, - use: [ { - loader: 'file-loader', - options: { - name: '[name].[ext]' - } - } ] + resolve: { + alias: { + '~': path.resolve(__dirname, '..'), + '@parity/abi': path.resolve(__dirname, '../node_modules/@parity/abi'), + '@parity/api': path.resolve(__dirname, '../node_modules/@parity/api'), + '@parity/etherscan': path.resolve(__dirname, '../node_modules/@parity/etherscan'), + '@parity/jsonrpc': path.resolve(__dirname, '../node_modules/@parity/jsonrpc'), + '@parity/shared': path.resolve(__dirname, '../node_modules/@parity/shared'), + '@parity/ui': path.resolve(__dirname, '../node_modules/@parity/ui'), + '@parity/wordlist': path.resolve(__dirname, '../node_modules/@parity/wordlist'), + '@parity': path.resolve(__dirname, '../packages') } - ] - }, - plugins: Shared.getPlugins() -}; + }, + + node: { + fs: 'empty' + }, + + module: { + rules: [ + rulesParity, + rulesEs6, + { + test: /\.js$/, + exclude: /node_modules/, + use: [ 'babel-loader' ] + }, + { + test: /\.json$/, + use: [ 'json-loader' ] + }, + { + test: /\.html$/, + use: [ { + loader: 'file-loader', + options: { + name: '[name].[ext]' + } + } ] + } + ] + }, + plugins: Shared.getPlugins() + }; +}); diff --git a/js/webpack/shared.js b/js/webpack/shared.js index f39c7790a..d49096e80 100644 --- a/js/webpack/shared.js +++ b/js/webpack/shared.js @@ -113,8 +113,6 @@ function getDappsEntry () { const builtins = require('@parity/shared/config/dappsBuiltin.json'); const views = require('@parity/shared/config/dappsViews.json'); - return {}; - return Object.assign( [] .concat(