Update build to pull from external repos
This commit is contained in:
parent
c509733a30
commit
f8bf4a1522
711
js/package-lock.json
generated
711
js/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -27,16 +27,16 @@
|
||||
],
|
||||
"scripts": {
|
||||
"build": "npm run build:lib && npm run build:app",
|
||||
"build:app": "parallel-webpack -p=2 --config webpack/app",
|
||||
"build:lib": "parallel-webpack -p=2 --config webpack/libraries",
|
||||
"build:app": "webpack --progress --config webpack/app",
|
||||
"build:lib": "webpack --progress --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 parallel-webpack -p=2 --config webpack/app",
|
||||
"ci:build:lib": "NODE_ENV=production parallel-webpack -p=2 --config webpack/libraries",
|
||||
"ci:build:npm": "NODE_ENV=production parallel-webpack -p=2 --config webpack/npm",
|
||||
"ci:build:app": "NODE_ENV=production webpack --progress --config webpack/app",
|
||||
"ci:build:lib": "NODE_ENV=production webpack --progress --config webpack/libraries",
|
||||
"ci:build:npm": "NODE_ENV=production webpack --progress --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 ./build ./node_modules/.cache",
|
||||
@ -50,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": "webpack-dev-server --progress --config webpack/app",
|
||||
"start:app": "node webpack/dev.server",
|
||||
"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'",
|
||||
@ -122,7 +122,6 @@
|
||||
"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",
|
||||
@ -144,7 +143,7 @@
|
||||
"to-source": "2.0.3",
|
||||
"uglify-js": "2.8.22",
|
||||
"url-loader": "0.5.7",
|
||||
"webpack": "2.4.1",
|
||||
"webpack": "3.3.0",
|
||||
"webpack-bundle-size-analyzer": "2.5.0",
|
||||
"webpack-dev-middleware": "1.10.1",
|
||||
"webpack-dev-server": "2.6.1",
|
||||
@ -155,13 +154,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@parity/api": "paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc",
|
||||
"@parity/dapps": "file:packages/dapps",
|
||||
"@parity/etherscan": "paritytech/js-etherscan#efe859ac7d2a8a3cc05e01c689b7fa58f47f8b87",
|
||||
"@parity/ledger": "file:packages/ledger",
|
||||
"@parity/shapeshift": "file:packages/shapeshift",
|
||||
"@parity/shared": "paritytech/js-shared#a83c71946d30d5b3bf976860a676add29c48ee24",
|
||||
"@parity/dapp-accounts": "paritytech/dapp-accounts#b4b7113ba8ea25d11dfc0ed6d6c93b85c8a7fac8",
|
||||
"@parity/shared": "paritytech/js-shared#438912f286ca09209e53fda5808205fca2c62940",
|
||||
"@parity/ui": "paritytech/js-ui#037782bd16e8abf1c169143aa61749a44b94489b",
|
||||
"@parity/wordlist": "1.0.1",
|
||||
"es6-error": "4.0.0",
|
||||
"es6-promise": "4.0.5",
|
||||
"flat": "2.0.1",
|
||||
@ -170,14 +165,13 @@
|
||||
"format-number": "2.0.1",
|
||||
"isomorphic-fetch": "2.2.1",
|
||||
"lodash": "4.17.2",
|
||||
"loglevel": "1.4.1",
|
||||
"moment": "2.17.0",
|
||||
"promise-worker": "1.1.1",
|
||||
"prop-types": "15.5.10",
|
||||
"react": "15.6.1",
|
||||
"react-dom": "15.6.1",
|
||||
"react-inspector": "paritytech/react-inspector",
|
||||
"react-intl": "2.1.5",
|
||||
"react-markdown": "2.5.0",
|
||||
"react-router": "3.0.0",
|
||||
"react-router-redux": "4.0.7",
|
||||
"react-tap-event-plugin": "2.0.1",
|
||||
@ -188,12 +182,9 @@
|
||||
"redux-thunk": "2.1.0",
|
||||
"store": "1.3.20",
|
||||
"sw-toolbox": "^3.6.0",
|
||||
"u2f-api": "0.0.9",
|
||||
"u2f-api-polyfill": "0.4.3",
|
||||
"useragent.js": "0.5.6",
|
||||
"utf8": "2.1.2",
|
||||
"web3": "0.17.0-beta",
|
||||
"whatwg-fetch": "2.0.1",
|
||||
"worker-loader": "^0.8.0"
|
||||
"whatwg-fetch": "2.0.1"
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import { FormattedMessage } from 'react-intl';
|
||||
import { connect } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import UpgradeStore from '@parity/shared/mobx/upgradeParity';
|
||||
import { Errors } from '@parity/ui';
|
||||
|
||||
import Connection from '../Connection';
|
||||
@ -31,7 +32,6 @@ import Requests from '../Requests';
|
||||
import Snackbar from '../Snackbar';
|
||||
import Status from '../Status';
|
||||
import UpgradeParity from '../UpgradeParity';
|
||||
import UpgradeStore from '../UpgradeParity/store';
|
||||
import SyncWarning, { showSyncWarning } from '../SyncWarning';
|
||||
|
||||
import Store from './store';
|
||||
|
@ -102,12 +102,14 @@ export default class Dapp extends Component {
|
||||
case 'local':
|
||||
src = `${dappsUrl}/${app.id}/`;
|
||||
break;
|
||||
|
||||
case 'network':
|
||||
src = `${dappsUrl}/${app.contentHash}/`;
|
||||
break;
|
||||
|
||||
default:
|
||||
let dapphost = process.env.DAPPS_URL || (
|
||||
process.env.NODE_ENV === 'production' && !app.secure
|
||||
process.env.NODE_ENV === 'production'
|
||||
? `${dappsUrl}/ui`
|
||||
: ''
|
||||
);
|
||||
@ -116,7 +118,11 @@ export default class Dapp extends Component {
|
||||
dapphost = '';
|
||||
}
|
||||
|
||||
src = `${dapphost}/${app.url}.html`;
|
||||
const appId = this.context.api.util.isHex(app.id)
|
||||
? app.id
|
||||
: this.context.api.sha3(app.url);
|
||||
|
||||
src = `${dapphost}/dapps/${appId}/index.html`;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -27,11 +27,9 @@ import web3extensions from './web3.extensions';
|
||||
function initProvider () {
|
||||
let [, appId] = window.location.pathname.split('/');
|
||||
|
||||
if (appId.indexOf('.html') !== -1) {
|
||||
appId = appId.replace('.html', '');
|
||||
}
|
||||
console.log('window.location.pathname', window.location.pathname, appId);
|
||||
|
||||
if (appId.substr(0, 2) !== '0x') {
|
||||
if (!Api.util.isHex(appId)) {
|
||||
appId = Api.util.sha3(appId);
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
const Api = require('@parity/api');
|
||||
const path = require('path');
|
||||
const flatten = require('lodash.flatten');
|
||||
// const ReactIntlAggregatePlugin = require('react-intl-aggregate-webpack-plugin');
|
||||
const WebpackErrorNotificationPlugin = require('webpack-error-notification');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
@ -27,10 +29,11 @@ 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_VIEWS = require('@parity/shared/config/dappsViews.json');
|
||||
const DAPPS_ALL = []
|
||||
.concat(DAPPS_BUILTIN, DAPPS_VIEWS)
|
||||
.filter((dapp) => !dapp.skipBuild)
|
||||
.filter((dapp) => dapp.package);
|
||||
|
||||
const FAVICON = path.resolve(__dirname, '../node_modules/@parity/shared/assets/images/parity-logo-black-no-text.png');
|
||||
|
||||
@ -42,231 +45,207 @@ const isProd = ENV === 'production';
|
||||
const isEmbed = EMBED === '1' || EMBED === 'true';
|
||||
|
||||
const entry = isEmbed
|
||||
? {
|
||||
embed: './embed.js'
|
||||
}
|
||||
: Object.assign({}, Shared.dappsEntry, {
|
||||
index: './index.js'
|
||||
});
|
||||
? { embed: './embed.js' }
|
||||
: { index: './index.js' };
|
||||
|
||||
module.exports = Object.keys(entry).map((entryName) => {
|
||||
const entrySrc = entry[entryName];
|
||||
module.exports = {
|
||||
cache: !isProd,
|
||||
devtool: isProd ? '#hidden-source-map' : '#source-map',
|
||||
|
||||
return {
|
||||
cache: !isProd,
|
||||
devtool: isProd ? '#hidden-source-map' : '#source-map',
|
||||
context: path.join(__dirname, '../src'),
|
||||
entry,
|
||||
output: {
|
||||
path: path.join(__dirname, '../', DEST),
|
||||
filename: '[name].js'
|
||||
},
|
||||
|
||||
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: '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')
|
||||
module: {
|
||||
rules: [
|
||||
rulesParity,
|
||||
rulesEs6,
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /(node_modules)/,
|
||||
use: [ 'babel-loader' ]
|
||||
},
|
||||
modules: [
|
||||
path.join(__dirname, '../node_modules')
|
||||
],
|
||||
extensions: ['.json', '.js', '.jsx'],
|
||||
unsafeCache: true
|
||||
{
|
||||
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, '..')
|
||||
},
|
||||
modules: [
|
||||
path.join(__dirname, '../node_modules')
|
||||
],
|
||||
extensions: ['.json', '.js', '.jsx'],
|
||||
unsafeCache: true
|
||||
},
|
||||
|
||||
node: {
|
||||
fs: 'empty'
|
||||
},
|
||||
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 ]
|
||||
});
|
||||
});
|
||||
plugins: (function () {
|
||||
let plugins = Shared.getPlugins().concat(
|
||||
new WebpackErrorNotificationPlugin()
|
||||
);
|
||||
|
||||
let plugins = Shared.getPlugins().concat(
|
||||
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')
|
||||
}),
|
||||
|
||||
new CopyWebpackPlugin(
|
||||
flatten([
|
||||
{
|
||||
from: './error_pages.css',
|
||||
to: 'styles.css'
|
||||
},
|
||||
flatten(
|
||||
DAPPS_ALL.map((dapp) => {
|
||||
const destination = Api.util.isHex(dapp.id)
|
||||
? dapp.id
|
||||
: Api.util.sha3(dapp.url);
|
||||
|
||||
return [
|
||||
{
|
||||
from: `../node_modules/${dapp.package}/dist`,
|
||||
to: `dapps/${destination}/dist/`
|
||||
},
|
||||
{
|
||||
from: `../node_modules/${dapp.package}/index.html`,
|
||||
to: `dapps/${destination}/`
|
||||
}
|
||||
];
|
||||
})
|
||||
)
|
||||
]),
|
||||
{}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (!isEmbed) {
|
||||
plugins = [].concat(
|
||||
plugins,
|
||||
if (isEmbed) {
|
||||
plugins.push(
|
||||
new HtmlWebpackPlugin({
|
||||
title: 'Parity Bar',
|
||||
filename: 'embed.html',
|
||||
template: './index.ejs',
|
||||
favicon: FAVICON,
|
||||
chunks: [ 'embed' ]
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
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) {
|
||||
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;
|
||||
}())
|
||||
};
|
||||
});
|
||||
return plugins;
|
||||
}())
|
||||
};
|
||||
|
35
js/webpack/build.server.js
Normal file
35
js/webpack/build.server.js
Normal file
@ -0,0 +1,35 @@
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
// 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);
|
||||
});
|
97
js/webpack/dev.server.js
Normal file
97
js/webpack/dev.server.js
Normal file
@ -0,0 +1,97 @@
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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 });
|
||||
});
|
@ -24,61 +24,53 @@ const Shared = require('./shared');
|
||||
|
||||
const DEST = process.env.BUILD_DEST || '.build';
|
||||
|
||||
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'
|
||||
},
|
||||
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'
|
||||
},
|
||||
|
||||
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')
|
||||
resolve: {
|
||||
alias: {
|
||||
'~': path.resolve(__dirname, '..')
|
||||
}
|
||||
},
|
||||
|
||||
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: {
|
||||
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()
|
||||
};
|
||||
});
|
||||
]
|
||||
},
|
||||
plugins: Shared.getPlugins()
|
||||
};
|
||||
|
@ -115,23 +115,6 @@ function getPlugins (_isProd = isProd) {
|
||||
return plugins;
|
||||
}
|
||||
|
||||
function getDappsEntry () {
|
||||
const builtins = require('@parity/shared/config/dappsBuiltin.json');
|
||||
const views = require('@parity/shared/config/dappsViews.json');
|
||||
|
||||
return Object.assign(
|
||||
[]
|
||||
.concat(
|
||||
builtins.filter((dapp) => !dapp.skipBuild),
|
||||
views
|
||||
)
|
||||
.reduce((_entry, dapp) => {
|
||||
_entry[dapp.url] = '../packages/dapp-' + dapp.url + '/index.js';
|
||||
return _entry;
|
||||
}, {})
|
||||
);
|
||||
}
|
||||
|
||||
function addProxies (app) {
|
||||
const proxy = require('http-proxy-middleware');
|
||||
|
||||
@ -166,6 +149,5 @@ function addProxies (app) {
|
||||
module.exports = {
|
||||
getBabelrc: getBabelrc,
|
||||
getPlugins: getPlugins,
|
||||
dappsEntry: getDappsEntry(),
|
||||
addProxies: addProxies
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user