Update build

This commit is contained in:
Jaco Greeff 2017-07-31 22:53:29 +02:00
parent 0b71baac4a
commit 0e7c115b73
7 changed files with 294 additions and 286 deletions

32
js/package-lock.json generated
View File

@ -3673,9 +3673,9 @@
"dev": true "dev": true
}, },
"copy-to-clipboard": { "copy-to-clipboard": {
"version": "3.0.7", "version": "3.0.8",
"resolved": "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.0.7.tgz", "resolved": "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.0.8.tgz",
"integrity": "sha1-DPtpxvVPRg3MnWxVg179y8ksSjo=", "integrity": "sha512-c3GdeY8qxCHGezVb1EFQfHYK/8NZRemgcTIzPq7PuxjHAf/raKibn2QdhHPb/y6q74PMgH6yizaDZlRmw6QyKw==",
"requires": { "requires": {
"toggle-selection": "1.0.6" "toggle-selection": "1.0.6"
} }
@ -7561,15 +7561,16 @@
} }
}, },
"happypack": { "happypack": {
"version": "3.0.3", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/happypack/-/happypack-3.0.3.tgz", "resolved": "https://registry.npmjs.org/happypack/-/happypack-3.1.0.tgz",
"integrity": "sha1-IveMh6MlzbeYyVjPTsOD/NTW/cc=", "integrity": "sha1-i8VeNwG6z/cY04icuItQIWQcrVk=",
"dev": true, "dev": true,
"requires": { "requires": {
"async": "1.5.0", "async": "1.5.0",
"json-stringify-safe": "5.0.1", "json-stringify-safe": "5.0.1",
"loader-utils": "0.2.16", "loader-utils": "0.2.16",
"mkdirp": "0.5.1" "mkdirp": "0.5.1",
"serialize-error": "2.1.0"
}, },
"dependencies": { "dependencies": {
"async": { "async": {
@ -10615,7 +10616,7 @@
"stream-browserify": "2.0.1", "stream-browserify": "2.0.1",
"stream-http": "2.7.2", "stream-http": "2.7.2",
"string_decoder": "0.10.31", "string_decoder": "0.10.31",
"timers-browserify": "2.0.2", "timers-browserify": "2.0.3",
"tty-browserify": "0.0.0", "tty-browserify": "0.0.0",
"url": "0.11.0", "url": "0.11.0",
"util": "0.10.3", "util": "0.10.3",
@ -12556,7 +12557,7 @@
"resolved": "https://registry.npmjs.org/react-copy-to-clipboard/-/react-copy-to-clipboard-4.2.3.tgz", "resolved": "https://registry.npmjs.org/react-copy-to-clipboard/-/react-copy-to-clipboard-4.2.3.tgz",
"integrity": "sha1-JoxaD73pqV2WFFAU5/hRELDn+44=", "integrity": "sha1-JoxaD73pqV2WFFAU5/hRELDn+44=",
"requires": { "requires": {
"copy-to-clipboard": "3.0.7" "copy-to-clipboard": "3.0.8"
} }
}, },
"react-datetime": { "react-datetime": {
@ -13600,6 +13601,12 @@
} }
} }
}, },
"serialize-error": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-2.1.0.tgz",
"integrity": "sha1-ULZ51WNc34Rme9yOWa9OW4HV9go=",
"dev": true
},
"serve-static": { "serve-static": {
"version": "1.11.2", "version": "1.11.2",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.11.2.tgz", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.11.2.tgz",
@ -14687,11 +14694,12 @@
"dev": true "dev": true
}, },
"timers-browserify": { "timers-browserify": {
"version": "2.0.2", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.2.tgz", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.3.tgz",
"integrity": "sha1-q0iDz1l9zVCvIRNJoA+8pWrIa4Y=", "integrity": "sha512-+JAqyNgg+M8+gXIrq2EeUr4kZqRz47Ysco7X5QKRGScRE9HIHckyHD1asozSFGeqx2nmPCgA8T5tIGVO0ML7/w==",
"dev": true, "dev": true,
"requires": { "requires": {
"global": "4.3.2",
"setimmediate": "1.0.5" "setimmediate": "1.0.5"
} }
}, },

View File

@ -27,19 +27,19 @@
], ],
"scripts": { "scripts": {
"build": "npm run build:lib && npm run build:app", "build": "npm run build:lib && npm run build:app",
"build:app": "parallel-webpack -p=4 --config webpack/app", "build:app": "webpack --config webpack/app",
"build:lib": "parallel-webpack -p=4 --config webpack/libraries", "build:lib": "webpack --config webpack/libraries",
"build:markdown": "babel-node ./scripts/build-rpc-markdown.js", "build:markdown": "babel-node ./scripts/build-rpc-markdown.js",
"build:json": "babel-node ./scripts/build-rpc-json.js", "build:json": "babel-node ./scripts/build-rpc-json.js",
"build:embed": "EMBED=1 node webpack/embed", "build:embed": "EMBED=1 node webpack/embed",
"build:i18n": "npm run clean && npm run build && babel-node ./scripts/build-i18n.js", "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": "npm run ci:build:lib && npm run ci:build:app && npm run ci:build:embed",
"ci:build:app": "NODE_ENV=production parallel-webpack -p=4 --config webpack/app", "ci:build:app": "NODE_ENV=production webpack --config webpack/app",
"ci:build:lib": "NODE_ENV=production parallel-webpack -p=4 --config webpack/libraries", "ci:build:lib": "NODE_ENV=production webpack --config webpack/libraries",
"ci:build:npm": "NODE_ENV=production parallel-webpack -p=4 --config webpack/npm", "ci:build:npm": "NODE_ENV=production webpack --config webpack/npm",
"ci:build:jsonrpc": "babel-node ./scripts/build-rpc-json.js --output .npmjs/jsonrpc", "ci:build:jsonrpc": "babel-node ./scripts/build-rpc-json.js --output .npmjs/jsonrpc",
"ci:build:embed": "NODE_ENV=production EMBED=1 node webpack/embed", "ci:build:embed": "NODE_ENV=production EMBED=1 node webpack/embed",
"clean": "rm -rf ./.build ./.coverage ./build ./node_modules/.cache", "clean": "rm -rf ./.build ./.coverage ./.happypack ./build ./node_modules/.cache",
"coveralls": "npm run testCoverage && coveralls < coverage/lcov.info", "coveralls": "npm run testCoverage && coveralls < coverage/lcov.info",
"lint": "npm run lint:css && npm run lint:js", "lint": "npm run lint:css && npm run lint:js",
"lint:cached": "npm run lint:css && npm run lint:js:cached", "lint:cached": "npm run lint:css && npm run lint:js:cached",
@ -106,7 +106,7 @@
"extract-text-webpack-plugin": "3.0.0", "extract-text-webpack-plugin": "3.0.0",
"file-loader": "0.10.0", "file-loader": "0.10.0",
"flow-bin": "^0.46.0", "flow-bin": "^0.46.0",
"happypack": "3.0.3", "happypack": "3.1.0",
"html-loader": "0.4.4", "html-loader": "0.4.4",
"html-webpack-plugin": "2.28.0", "html-webpack-plugin": "2.28.0",
"http-proxy-middleware": "0.17.3", "http-proxy-middleware": "0.17.3",

View File

@ -49,224 +49,218 @@ const entry = isEmbed
index: './index.js' index: './index.js'
}); });
module.exports = Object.keys(entry).map((entryName) => { module.exports = {
const entrySrc = entry[entryName]; cache: !isProd,
devtool: isProd ? '#hidden-source-map' : '#source-map',
return { context: path.join(__dirname, '../src'),
cache: !isProd, entry,
devtool: isProd ? '#hidden-source-map' : '#source-map', output: {
path: path.join(__dirname, '../', DEST),
filename: '[name].js'
},
context: path.join(__dirname, '../src'), module: {
entry: { rules: [
[entryName]: entrySrc rulesParity,
}, rulesEs6,
output: { {
path: path.join(__dirname, '../', DEST), test: /\.js$/,
filename: '[name].js' exclude: /(node_modules)/,
}, use: [ 'babel-loader' ]
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: 'assets/[name].[hash].[ext]'
}
} ]
},
{
test: /\.(woff|woff2|ttf|eot|otf)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: [ {
loader: 'file-loader',
options: {
name: 'fonts/[name][hash].[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].[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')
}, },
modules: [ {
path.join(__dirname, '../node_modules') test: /\.json$/,
], use: [ 'json-loader' ]
extensions: ['.json', '.js', '.jsx'], },
unsafeCache: true {
}, 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: 'assets/[name].[hash].[ext]'
}
} ]
},
{
test: /\.(woff|woff2|ttf|eot|otf)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: [ {
loader: 'file-loader',
options: {
name: 'fonts/[name][hash].[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].[ext]'
}
} ]
}
],
noParse: [
/node_modules\/sinon/
]
},
node: { resolve: {
fs: 'empty' 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 () { node: {
const DappsHTMLInjection = [] fs: 'empty'
.concat(DAPPS_BUILTIN, DAPPS_VIEWS) },
.filter((dapp) => !dapp.skipBuild)
.map((dapp) => { plugins: (function () {
return new HtmlWebpackPlugin({ const DappsHTMLInjection = []
title: dapp.name, .concat(DAPPS_BUILTIN, DAPPS_VIEWS)
filename: dapp.url + '.html', .filter((dapp) => !dapp.skipBuild)
template: '../packages/dapps/index.ejs', .map((dapp) => {
favicon: FAVICON, return new HtmlWebpackPlugin({
secure: dapp.secure, title: dapp.name,
chunks: [ dapp.url ] filename: dapp.url + '.html',
}); template: '../packages/dapps/index.ejs',
favicon: FAVICON,
secure: dapp.secure,
chunks: [ dapp.url ]
}); });
});
let plugins = Shared.getPlugins().concat( let plugins = Shared.getPlugins().concat(
new WebpackErrorNotificationPlugin() new WebpackErrorNotificationPlugin()
);
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' }
], {})
); );
}
if (!isEmbed) { if (isEmbed) {
plugins = [].concat( plugins.push(
plugins, new HtmlWebpackPlugin({
title: 'Parity Bar',
filename: 'embed.html',
template: './index.ejs',
favicon: FAVICON,
chunks: [ 'embed' ]
})
);
}
new HtmlWebpackPlugin({ // if (!isAnalize && !isProd) {
title: 'Parity', // const DEST_I18N = path.join(__dirname, '..', DEST, 'i18n');
filename: 'index.html', //
template: './index.ejs', // plugins.push(
favicon: FAVICON, // new ReactIntlAggregatePlugin({
chunks: [ 'index' ] // messagesPattern: DEST_I18N + '/i18n/**/*.json',
}), // aggregateOutputDir: DEST_I18N + '/i18n/',
// aggregateFilename: 'en'
// })
// );
// }
new ServiceWorkerWebpackPlugin({ return plugins;
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;
}())
};
});

View File

@ -24,61 +24,61 @@ const Shared = require('./shared');
const DEST = process.env.BUILD_DEST || '.build'; const DEST = process.env.BUILD_DEST || '.build';
module.exports = ['inject', 'parity', 'web3'].map((entryName) => { module.exports = {
return { context: path.join(__dirname, '../src'),
context: path.join(__dirname, '../src'), entry: {
entry: { inject: ['./inject.js'],
[entryName]: ['./inject.js'] parity: ['./inject.js'],
}, web3: ['./inject.js']
output: { },
path: path.join(__dirname, '../', DEST), output: {
filename: '[name].js', path: path.join(__dirname, '../', DEST),
library: '[name].js', filename: '[name].js',
libraryTarget: 'umd' library: '[name].js',
}, libraryTarget: 'umd'
},
resolve: { resolve: {
alias: { alias: {
'~': path.resolve(__dirname, '..'), '~': path.resolve(__dirname, '..'),
'@parity/abi': path.resolve(__dirname, '../node_modules/@parity/abi'), '@parity/abi': path.resolve(__dirname, '../node_modules/@parity/abi'),
'@parity/api': path.resolve(__dirname, '../node_modules/@parity/api'), '@parity/api': path.resolve(__dirname, '../node_modules/@parity/api'),
'@parity/etherscan': path.resolve(__dirname, '../node_modules/@parity/etherscan'), '@parity/etherscan': path.resolve(__dirname, '../node_modules/@parity/etherscan'),
'@parity/jsonrpc': path.resolve(__dirname, '../node_modules/@parity/jsonrpc'), '@parity/jsonrpc': path.resolve(__dirname, '../node_modules/@parity/jsonrpc'),
'@parity/shared': path.resolve(__dirname, '../node_modules/@parity/shared'), '@parity/shared': path.resolve(__dirname, '../node_modules/@parity/shared'),
'@parity/ui': path.resolve(__dirname, '../node_modules/@parity/ui'), '@parity/ui': path.resolve(__dirname, '../node_modules/@parity/ui'),
'@parity/wordlist': path.resolve(__dirname, '../node_modules/@parity/wordlist'), '@parity/wordlist': path.resolve(__dirname, '../node_modules/@parity/wordlist'),
'@parity': path.resolve(__dirname, '../packages') '@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]'
}
} ]
} }
}, ]
},
node: { plugins: Shared.getPlugins()
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()
};
});

View File

@ -17,5 +17,5 @@
module.exports = { module.exports = {
test: /\.js$/, test: /\.js$/,
include: /node_modules\/(get-own-enumerable-property-symbols|ethereumjs-tx|stringify-object)/, include: /node_modules\/(get-own-enumerable-property-symbols|ethereumjs-tx|stringify-object)/,
use: 'babel-loader' use: [ 'babel-loader' ]
}; };

View File

@ -17,5 +17,5 @@
module.exports = { module.exports = {
test: /\.js$/, test: /\.js$/,
include: /node_modules\/@parity\//, include: /node_modules\/@parity\//,
use: 'babel-loader' use: [ 'babel-loader' ]
}; };

View File

@ -18,6 +18,7 @@ const webpack = require('webpack');
const path = require('path'); const path = require('path');
const fs = require('fs'); const fs = require('fs');
// const HappyPack = require('happypack');
const CircularDependencyPlugin = require('circular-dependency-plugin'); const CircularDependencyPlugin = require('circular-dependency-plugin');
const PackageJson = require('../package.json'); const PackageJson = require('../package.json');
@ -83,6 +84,11 @@ function getPlugins (_isProd = isProd) {
UI_VERSION: JSON.stringify(UI_VERSION) UI_VERSION: JSON.stringify(UI_VERSION)
} }
}) })
// new HappyPack({
// id: 'babel',
// threads: 4,
// loaders: [ 'babel-loader' ]
// })
]; ];
if (_isProd) { if (_isProd) {