From 51d54e8406139dd68f6e12efb1f487bb99de8449 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 24 May 2017 12:07:53 +0200 Subject: [PATCH 1/7] Fix LICENCE --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aa3194becb..66555a39b4 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "type": "git", "url": "https://github.com/0xProject/0x.js" }, - "license": "Apache 2.0", + "license": "Apache-2.0", "engines": { "node": ">=6.0.0" }, From 91a34889f94422d02f08f76fb7442b2556424ec5 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 24 May 2017 12:08:15 +0200 Subject: [PATCH 2/7] Add webpack config and npm scripts --- package.json | 16 ++++++++++++++-- webpack.config.js | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 webpack.config.js diff --git a/package.json b/package.json index 66555a39b4..d927546138 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,13 @@ "tokens", "exchange" ], + "scripts": { + "clean": "shx rm -rf _bundles lib lib-esm", + "build:bundle": "webpack", + "build:commonjs": "tsc", + "build:es6": "tsc -m es6 --outDir lib-esm", + "build": "npm run clean && run-p build:*" + }, "repository": { "type": "git", "url": "https://github.com/0xProject/0x.js" @@ -17,7 +24,12 @@ "engines": { "node": ">=6.0.0" }, - "dependencies": { - "tslint-config-0xproject": "^0.0.0" + "devDependencies": { + "awesome-typescript-loader": "^3.1.3", + "npm-run-all": "^4.0.2", + "shx": "^0.2.2", + "tslint-config-0xproject": "^0.0.0", + "typescript": "^2.3.3", + "webpack": "^2.6.0" } } diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000000..7c7685ebe9 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,37 @@ +const webpack = require('webpack'); +const path = require('path'); + +module.exports = { + entry: { + '0x': './src/ts/0x.js.ts', + '0x.min': './src/ts/0x.js.ts' + }, + output: { + path: path.resolve(__dirname, '_bundles'), + filename: '[name].js', + libraryTarget: 'umd', + library: 'zeroEx', + umdNamedDefine: true + }, + resolve: { + extensions: ['.ts', '.js'] + }, + devtool: 'source-map', + plugins: [ + new webpack.optimize.UglifyJsPlugin({ + minimize: true, + sourceMap: true, + include: /\.min\.js$/, + }) + ], + module: { + loaders: [{ + test: /\.ts$/, + loader: 'awesome-typescript-loader', + exclude: /node_modules/, + query: { + declaration: false, + } + }] + } +} From 5538c04b2d67c39c56b18e1cf0aaaf0e622cca1d Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 24 May 2017 12:08:27 +0200 Subject: [PATCH 3/7] Add .npmignore --- .npmignore | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .npmignore diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000000..fb89e016aa --- /dev/null +++ b/.npmignore @@ -0,0 +1,6 @@ +.* +tsconfig.json +tslint.json +webpack.config.js +yarn.lock +src \ No newline at end of file From 17867c5de968992d9dbeca630db144f5f321b823 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 24 May 2017 12:11:56 +0200 Subject: [PATCH 4/7] newline --- .npmignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.npmignore b/.npmignore index fb89e016aa..db6c83e43d 100644 --- a/.npmignore +++ b/.npmignore @@ -3,4 +3,5 @@ tsconfig.json tslint.json webpack.config.js yarn.lock -src \ No newline at end of file +src + From 5064fd0026f8d2edfee52fb5b5ba455975e2133a Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 24 May 2017 12:16:00 +0200 Subject: [PATCH 5/7] Capitalize library name --- webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 7c7685ebe9..90c927eb4e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,7 +10,7 @@ module.exports = { path: path.resolve(__dirname, '_bundles'), filename: '[name].js', libraryTarget: 'umd', - library: 'zeroEx', + library: 'ZeroEx', umdNamedDefine: true }, resolve: { From a5678aa3f161791a79452ca6d4d80960ff72754e Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 24 May 2017 12:21:56 +0200 Subject: [PATCH 6/7] Add clarifiing comment to webpack config --- webpack.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index 90c927eb4e..4621e94dd3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,3 +1,6 @@ +/** + * This is to generate the umd bundle only + */ const webpack = require('webpack'); const path = require('path'); From 3097f8cdfbcc778c65a0b48dcfa4448767ab3713 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 24 May 2017 12:40:36 +0200 Subject: [PATCH 7/7] Add trailing comas --- webpack.config.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 4621e94dd3..04822d79dc 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -14,10 +14,10 @@ module.exports = { filename: '[name].js', libraryTarget: 'umd', library: 'ZeroEx', - umdNamedDefine: true + umdNamedDefine: true, }, resolve: { - extensions: ['.ts', '.js'] + extensions: ['.ts', '.js'], }, devtool: 'source-map', plugins: [ @@ -25,7 +25,7 @@ module.exports = { minimize: true, sourceMap: true, include: /\.min\.js$/, - }) + }), ], module: { loaders: [{ @@ -34,7 +34,7 @@ module.exports = { exclude: /node_modules/, query: { declaration: false, - } - }] - } -} + }, + }], + }, +};