From e676f00dfa764d2398262114f2ac4c1586f58909 Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Thu, 24 Nov 2016 03:26:38 +0100 Subject: [PATCH] Wepback dapps --- js/src/dapps/index.js | 25 +++++++++++++++++++++++++ js/webpack/config.js | 16 ++-------------- js/webpack/shared.js | 10 ++++++++++ 3 files changed, 37 insertions(+), 14 deletions(-) create mode 100644 js/src/dapps/index.js diff --git a/js/src/dapps/index.js b/js/src/dapps/index.js new file mode 100644 index 000000000..9cba69701 --- /dev/null +++ b/js/src/dapps/index.js @@ -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 . + +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' } +]; diff --git a/js/webpack/config.js b/js/webpack/config.js index a99984f27..65a999bb9 100644 --- a/js/webpack/config.js +++ b/js/webpack/config.js @@ -26,6 +26,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin'); 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'; @@ -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 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 -const entry = DAPPS.reduce((_entry, dapp) => { - _entry[dapp.name] = dapp.entry; - return _entry; -}, {}); +const entry = Shared.dappsEntry; // main UI entry.index = './index.js'; diff --git a/js/webpack/shared.js b/js/webpack/shared.js index cc2553da2..b5a46a11c 100644 --- a/js/webpack/shared.js +++ b/js/webpack/shared.js @@ -68,6 +68,15 @@ function getPlugins (_isProd = isProd) { return plugins; } +function getDappsEntry () { + const DAPPS = require('../src/dapps'); + + return DAPPS.reduce((_entry, dapp) => { + _entry[dapp.name] = './dapps/' + dapp.entry; + return _entry; + }, {}); +} + const proxies = [ { context: (pathname, req) => { @@ -108,5 +117,6 @@ const proxies = [ module.exports = { getPlugins: getPlugins, + dappsEntry: getDappsEntry(), proxies: proxies };