From eada6fd90cbd5c46be0adace2aba7c0b0c8d0cf1 Mon Sep 17 00:00:00 2001 From: Justin Tormey Date: Tue, 14 Mar 2017 11:11:56 -0400 Subject: [PATCH] chore(Build): convert src files to es5 before publishing --- .gitignore | 1 + .npmignore | 11 +++++++++++ package.json | 5 ++++- index.js => src/index.js | 36 ++++++++++++++++++------------------ webpack.config.js | 2 +- 5 files changed, 35 insertions(+), 20 deletions(-) create mode 100644 .npmignore rename index.js => src/index.js (56%) diff --git a/.gitignore b/.gitignore index 5c1bc40a4..5d5c9fc18 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ npm-debug.log # Generated js files build dist +lib # Generated coverage reports coverage diff --git a/.npmignore b/.npmignore new file mode 100644 index 000000000..5b4762b1e --- /dev/null +++ b/.npmignore @@ -0,0 +1,11 @@ +node_modules +build +coverage +coverage-lcov +npm-debug.log +tests +.travis.yml +Changelog.md +karma.conf.js +Makefile +webpack.config.js diff --git a/package.json b/package.json index 680a643ab..36a220886 100644 --- a/package.json +++ b/package.json @@ -21,12 +21,14 @@ "Kevin Woudini", "Justin Tormey" ], - "main": "index.js", + "main": "lib/index.js", + "module": "src/index.js", "repository": { "type": "git", "url": "https://github.com/blockchain/my-wallet-v3.git" }, "scripts": { + "prepublish": "node_modules/.bin/babel src --presets babel-preset-es2015 --out-dir lib", "dist": "NODE_ENV=\"prod\" ./node_modules/.bin/webpack", "build": "./node_modules/.bin/webpack --progress", "build:watch": "./node_modules/.bin/webpack -w", @@ -53,6 +55,7 @@ "ws": "2.0.*" }, "devDependencies": { + "babel-cli": "~6.24.0", "babel-loader": "6.2.10", "babel-plugin-transform-object-assign": "~6.22.0", "babel-polyfill": "6.16.*", diff --git a/index.js b/src/index.js similarity index 56% rename from index.js rename to src/index.js index 30c7ef7c5..f99f87890 100644 --- a/index.js +++ b/src/index.js @@ -25,25 +25,25 @@ try { module.exports = { Buffer: Buffer, - MyWallet: require('./src/wallet'), - WalletStore: require('./src/wallet-store'), - WalletCrypto: require('./src/wallet-crypto'), - Payment: require('./src/payment'), - ImportExport: require('./src/import-export'), - BlockchainSettingsAPI: require('./src/blockchain-settings-api'), - Helpers: require('./src/helpers'), - API: require('./src/api'), - Tx: require('./src/wallet-transaction'), - WalletTokenEndpoints: require('./src/wallet-token-endpoints'), - WalletNetwork: require('./src/wallet-network'), - RNG: require('./src/rng'), - Transaction: require('./src/transaction'), - Address: require('./src/address'), - Metadata: require('./src/metadata'), + MyWallet: require('./wallet'), + WalletStore: require('./wallet-store'), + WalletCrypto: require('./wallet-crypto'), + Payment: require('./payment'), + ImportExport: require('./import-export'), + BlockchainSettingsAPI: require('./blockchain-settings-api'), + Helpers: require('./helpers'), + API: require('./api'), + Tx: require('./wallet-transaction'), + WalletTokenEndpoints: require('./wallet-token-endpoints'), + WalletNetwork: require('./wallet-network'), + RNG: require('./rng'), + Transaction: require('./transaction'), + Address: require('./address'), + Metadata: require('./metadata'), Bitcoin: require('bitcoinjs-lib'), - External: require('./src/external'), - BuySell: require('./src/buy-sell'), - constants: require('./src/constants'), + External: require('./external'), + BuySell: require('./buy-sell'), + constants: require('./constants'), BigInteger: require('bigi/lib'), BIP39: require('bip39'), Networks: require('bitcoinjs-lib/src/networks'), diff --git a/webpack.config.js b/webpack.config.js index e6461c413..18a4df5e1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,7 +3,7 @@ let webpack = require('webpack'); let StringReplacePlugin = require('string-replace-webpack-plugin'); let config = { - entry: './index.js', + entry: './src/index.js', output: { path: path.resolve(__dirname, 'dist'), filename: 'my-wallet.js',