From 9e6c2c9e2558ac2c20fddc39f0d182264b31a7f8 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 17:39:19 +0200 Subject: [PATCH 1/8] Add all browser bundles --- README.md | 69 +++++++++++++++++++++++++++++++++++++++++++++-- webpack.config.js | 51 ++++++++++++++++++++++++++++------- 2 files changed, 108 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e945922..4ddb738 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,15 @@ * [Authors](#authors) * [License](#license) -## Installation +## Node.js + +### Installation ```bash npm install bigchaindb-driver ``` -### Example: Create a transaction +#### Example: Create a transaction ```js import * as driver from 'bigchaindb-driver' @@ -74,6 +76,69 @@ conn.postTransaction(txSigned) .then((res) => console.log('Transaction status:', res.status)) ``` +## Browser + +### Installation and Usage + +```html + + + + + HTML5 boilerplate – all you really need… + + + + + + + +

Hello BigchainDB

+ + + +``` + ## BigchainDB Documentation - [HTTP API Reference](https://docs.bigchaindb.com/projects/server/en/latest/http-client-server-api.html) diff --git a/webpack.config.js b/webpack.config.js index 211f43e..13e0def 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -14,6 +14,39 @@ const PATHS = { NODE_MODULES: path.resolve(__dirname, 'node_modules'), } +const OUTPUTS = [ + { + filename: PRODUCTION ? 'bundle.window.min.js' : 'bundle.window.js', + library: 'BigchainDB', + libraryTarget: 'window', + path: PATHS.BUNDLE, + }, + { + filename: PRODUCTION ? 'bundle.umd.min.js' : 'bundle.umd.js', + library: 'bigchaindb-driver', + libraryTarget: 'umd', + path: PATHS.BUNDLE, + }, + { + filename: PRODUCTION ? 'bundle.cjs.min.js' : 'bundle.cjs.js', + library: 'bigchaindb-driver', + libraryTarget: 'commonjs', + path: PATHS.BUNDLE, + }, + { + filename: PRODUCTION ? 'bundle.cjs2.min.js' : 'bundle.cjs2.js', + library: 'bigchaindb-driver', + libraryTarget: 'commonjs2', + path: PATHS.BUNDLE, + }, + { + filename: PRODUCTION ? 'bundle.amd.min.js' : 'bundle.amd.js', + library: 'bigchaindb-driver', + libraryTarget: 'amd', + path: PATHS.BUNDLE, + } +] + /** PLUGINS **/ const PLUGINS = [ @@ -40,18 +73,9 @@ if (PRODUCTION) { PLUGINS.push(...PROD_PLUGINS) } - -/** EXPORTED WEBPACK CONFIG **/ -const config = { +const configBoilerplate = { entry: [PATHS.ENTRY], - output: { - filename: PRODUCTION ? 'bundle.min.js' : 'bundle.js', - library: 'js-bigchaindb-driver', - libraryTarget: 'umd', - path: PATHS.BUNDLE, - }, - devtool: PRODUCTION ? '#source-map' : '#inline-source-map', resolve: { @@ -77,4 +101,11 @@ const config = { }, } +/** EXPORTED WEBPACK CONFIG **/ +const config = OUTPUTS.map(output => { + const configCopy = Object.assign({}, configBoilerplate) + configCopy.output = output + return configCopy +}) + module.exports = config From 41eab7feab451bbc11ec6c9ddc5c04afe61fe9ab Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 17:43:17 +0200 Subject: [PATCH 2/8] Fix browser docs for new rls --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ddb738..d1e6a31 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ conn.postTransaction(txSigned) HTML5 boilerplate – all you really need… - + + // Check console for the transaction's status + - -

Hello BigchainDB

- ``` From f15868356320c2692ef6eaee74979c2b22333562 Mon Sep 17 00:00:00 2001 From: tim Date: Thu, 22 Jun 2017 10:53:22 +0200 Subject: [PATCH 4/8] bundle => bigchaindb-driver --- README.md | 2 +- webpack.config.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2c07b9b..f8f1be5 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ conn.postTransaction(txSigned) HTML5 boilerplate – all you really need… - +