From 2447875b269ac47ffe14b653d4a42b6da0fc89e5 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 3 Apr 2017 12:16:41 +0200 Subject: [PATCH] Update npm build for new inclusions (#5381) * Update npm build for new inclusions * Add dummy interface for secp256k1 --- js/src/api/local/ethkey/dummy.js | 19 +++++++++++++++++++ js/webpack/npm.js | 13 +++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 js/src/api/local/ethkey/dummy.js diff --git a/js/src/api/local/ethkey/dummy.js b/js/src/api/local/ethkey/dummy.js new file mode 100644 index 000000000..38f7c84de --- /dev/null +++ b/js/src/api/local/ethkey/dummy.js @@ -0,0 +1,19 @@ +// 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 . + +export default function () { + // empty file included while building parity.js (don't include local keygen) +} diff --git a/js/webpack/npm.js b/js/webpack/npm.js index b1f41d805..b526b2f0f 100644 --- a/js/webpack/npm.js +++ b/js/webpack/npm.js @@ -24,9 +24,11 @@ const ENV = process.env.NODE_ENV || 'development'; const isProd = ENV === 'production'; const LIBRARY = process.env.LIBRARY; + if (!LIBRARY) { process.exit(-1); } + const SRC = LIBRARY.toLowerCase(); const OUTPUT_PATH = path.join(__dirname, '../.npmjs', SRC); @@ -63,12 +65,18 @@ module.exports = { 'babel-loader?cacheDirectory=true' ], exclude: /node_modules/ + }, + { + test: /\.js$/, + include: /node_modules\/(ethereumjs-tx|@parity\/wordlist)/, + use: 'babel-loader' } ] }, resolve: { alias: { + 'secp256k1/js': path.resolve(__dirname, '../src/api/local/ethkey/dummy.js'), '~': path.resolve(__dirname, '../src') }, modules: [ @@ -85,15 +93,12 @@ module.exports = { to: 'package.json', transform: function (content, path) { const json = JSON.parse(content.toString()); - json.version = packageJson.version; - // Add tests dependencies to Dev Deps json.devDependencies.chai = packageJson.devDependencies.chai; json.devDependencies.mocha = packageJson.devDependencies.mocha; json.devDependencies.nock = packageJson.devDependencies.nock; - - // Add test script json.scripts.test = 'mocha \'test/*.spec.js\''; + json.version = packageJson.version; return new Buffer(JSON.stringify(json, null, ' '), 'utf-8'); }