diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-05-29 19:27:26 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-05-29 19:27:26 +0800 |
commit | 6213407f544e34c13a4d125136d14a1d888d8c6a (patch) | |
tree | e36966561582c40ad4fe5b94ed9df0e47a4a207c | |
parent | 055763cd373c5203182bc269ee3f8f737a34ba8e (diff) | |
download | dexon-sol-tools-6213407f544e34c13a4d125136d14a1d888d8c6a.tar dexon-sol-tools-6213407f544e34c13a4d125136d14a1d888d8c6a.tar.gz dexon-sol-tools-6213407f544e34c13a4d125136d14a1d888d8c6a.tar.bz2 dexon-sol-tools-6213407f544e34c13a4d125136d14a1d888d8c6a.tar.lz dexon-sol-tools-6213407f544e34c13a4d125136d14a1d888d8c6a.tar.xz dexon-sol-tools-6213407f544e34c13a4d125136d14a1d888d8c6a.tar.zst dexon-sol-tools-6213407f544e34c13a4d125136d14a1d888d8c6a.zip |
Refactor test commands
-rw-r--r-- | package.json | 24 | ||||
-rw-r--r-- | webpack.config.js | 13 |
2 files changed, 24 insertions, 13 deletions
diff --git a/package.json b/package.json index ab6b4d928..b2c7d4b19 100644 --- a/package.json +++ b/package.json @@ -10,21 +10,27 @@ "exchange" ], "scripts": { - "build": "npm run clean && run-p build:*", + "build": "npm run clean && run-p build:*:prod", "lint": "tslint src/**/*.ts", - "test": "run-s build test:commonjs test:umd", + "test": "run-s build:dev test:commonjs test:umd", "test:coverage": "nyc npm run test --all", "update_contracts": "for i in ${npm_package_config_artifacts}; do copyfiles -u 4 ../contracts/build/contracts/$i.json ../0x.js/src/artifacts; done;", "testrpc": "testrpc -p 8545 --networkId 50", - - "clean": "shx rm -rf _bundles lib", - "build:umd": "webpack", - "build:commonjs": "tsc; copyfiles -u 2 ./src/artifacts/*.json ../0x.js/lib/src/artifacts;", - "test:commonjs": "mocha lib/test/**/*_test.js", - "test:umd": "shx rm -rf lib/src/* && mv _bundles/* lib/src && npm run test:commonjs", "docs:json": "typedoc --json docs/index.json .", "docs:generate": "typedoc --out docs .", - "docs:open": "opn docs/index.html" + "docs:open": "opn docs/index.html", + + "clean": "shx rm -rf _bundles lib", + "build:dev": "npm run clean && run-p build:*:dev", + "build:umd:dev": "webpack", + "build:umd:prod": "webpack -p", + "build:commonjs:dev": "tsc; copyfiles -u 2 ./src/artifacts/*.json ../0x.js/lib/src/artifacts;", + "run_mocha": "mocha test_temp/test/**/*_test.js", + "test:commonjs": "run-s build:commonjs:dev setup_commonjs run_mocha tear_down", + "test:umd": "run-s build:*:dev setup_umd run_mocha tear_down", + "setup_commonjs": "shx cp -r lib test_temp", + "setup_umd": "shx mkdir -p test_temp/src && shx cp _bundles/* test_temp/src && shx cp -r lib/test test_temp/test", + "tear_down": "shx rm -rf test_temp" }, "config": { "artifacts": "Proxy Exchange TokenRegistry Token Mintable EtherToken" diff --git a/webpack.config.js b/webpack.config.js index 7b7b10b52..9718477aa 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,12 +3,17 @@ */ const webpack = require('webpack'); const path = require('path'); +const PROD = process.env.NODE_ENV === 'production'; + +let entry = { + '0x': './src/0x.js.ts', +}; +if (PROD) { + entry = Object.assign({}, entry, {'0x.min': './src/0x.js.ts'}); +} module.exports = { - entry: { - '0x': './src/0x.js.ts', - '0x.min': './src/0x.js.ts' - }, + entry, output: { path: path.resolve(__dirname, '_bundles'), filename: '[name].js', |