Wepback dapps

This commit is contained in:
Nicolas Gotchac 2016-11-24 03:26:38 +01:00
parent 259b91da50
commit e676f00dfa
3 changed files with 37 additions and 14 deletions

25
js/src/dapps/index.js Normal file
View File

@ -0,0 +1,25 @@
// 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 <http://www.gnu.org/licenses/>.
module.exports = [
{ name: 'basiccoin', entry: 'basiccoin.js', title: 'Basic Token Deployment' },
{ name: 'dappreg', entry: 'dappreg.js', title: 'Dapp Registry' },
{ name: 'githubhint', entry: 'githubhint.js', title: 'GitHub Hint', secure: true },
{ name: 'localtx', entry: 'localtx.js', title: 'Local transactions Viewer', secure: true },
{ name: 'registry', entry: 'registry.js', title: 'Registry' },
{ name: 'signaturereg', entry: 'signaturereg.js', title: 'Method Signature Registry' },
{ name: 'tokenreg', entry: 'tokenreg.js', title: 'Token Registry' }
];

View File

@ -26,6 +26,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const Shared = require('./shared'); const Shared = require('./shared');
const DAPPS = require('../src/dapps');
const ENV = process.env.NODE_ENV || 'development'; const ENV = process.env.NODE_ENV || 'development';
const isProd = ENV === 'production'; const isProd = ENV === 'production';
@ -33,21 +34,8 @@ const DEST = process.env.BUILD_DEST || '.build';
const FAVICON = path.resolve(__dirname, '../assets/images/parity-logo-black-no-text.png'); const FAVICON = path.resolve(__dirname, '../assets/images/parity-logo-black-no-text.png');
const DAPPS = [
{ name: 'basiccoin', entry: './dapps/basiccoin.js', title: 'Basic Token Deployment' },
{ name: 'dappreg', entry: './dapps/dappreg.js', title: 'Dapp Registry' },
{ name: 'githubhint', entry: './dapps/githubhint.js', title: 'GitHub Hint', secure: true },
{ name: 'localtx', entry: './dapps/localtx.js', title: 'Local transactions Viewer', secure: true },
{ name: 'registry', entry: './dapps/registry.js', title: 'Registry' },
{ name: 'signaturereg', entry: './dapps/signaturereg.js', title: 'Method Signature Registry' },
{ name: 'tokenreg', entry: './dapps/tokenreg.js', title: 'Token Registry' }
];
// dapps // dapps
const entry = DAPPS.reduce((_entry, dapp) => { const entry = Shared.dappsEntry;
_entry[dapp.name] = dapp.entry;
return _entry;
}, {});
// main UI // main UI
entry.index = './index.js'; entry.index = './index.js';

View File

@ -68,6 +68,15 @@ function getPlugins (_isProd = isProd) {
return plugins; return plugins;
} }
function getDappsEntry () {
const DAPPS = require('../src/dapps');
return DAPPS.reduce((_entry, dapp) => {
_entry[dapp.name] = './dapps/' + dapp.entry;
return _entry;
}, {});
}
const proxies = [ const proxies = [
{ {
context: (pathname, req) => { context: (pathname, req) => {
@ -108,5 +117,6 @@ const proxies = [
module.exports = { module.exports = {
getPlugins: getPlugins, getPlugins: getPlugins,
dappsEntry: getDappsEntry(),
proxies: proxies proxies: proxies
}; };