diff --git a/package.json b/package.json index 0111b0359..6cc0cd2a5 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,16 @@ "description": "Redux bindings for React", "main": "./lib/index.js", "scripts": { - "browser": "scripts/browser", - "build": "scripts/build", - "clean": "scripts/clean", - "lint": "scripts/lint", - "prepublish": "scripts/prepublish", - "test": "scripts/test", - "test:watch": "scripts/test-watch", - "test:cov": "scripts/test-cov" + "build:lib": "babel src --out-dir lib", + "build:umd": "webpack src/index.js dist/react-redux.js --config webpack.config.development.js", + "build:umd:min": "webpack src/index.js dist/react-redux.min.js --config webpack.config.production.js", + "build": "npm run build:lib && npm run build:umd && npm run build:umd:min", + "clean": "rimraf lib dist coverage", + "lint": "eslint src test", + "prepublish": "npm run clean && npm run build", + "test": "mocha --compilers js:babel/register --recursive", + "test:watch": "npm test -- --watch", + "test:cov": "babel-node ./node_modules/isparta/bin/isparta cover ./node_modules/mocha/bin/_mocha -- --recursive" }, "repository": { "type": "git", @@ -36,14 +38,15 @@ "homepage": "https://github.com/gaearon/react-redux", "devDependencies": { "babel": "^5.5.8", - "babel-core": "5.6.15", + "babel-core": "5.6.18", "babel-eslint": "^3.1.15", "babel-loader": "^5.1.4", "eslint": "^0.23", "eslint-config-airbnb": "0.0.6", "eslint-plugin-react": "^2.3.0", - "expect": "^1.6.0", - "istanbul": "^0.3.15", + "expect": "^1.8.0", + "isparta": "^3.0.3", + "istanbul": "^0.3.17", "jsdom": "~5.4.3", "mocha": "^2.2.5", "mocha-jsdom": "~0.4.0", diff --git a/scripts/browser b/scripts/browser deleted file mode 100755 index 028c08251..000000000 --- a/scripts/browser +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -e - -WEBPACK_CMD=node_modules/.bin/webpack - -mkdir -p dist - -$WEBPACK_CMD src/index.js dist/react-redux.js -NODE_ENV=production $WEBPACK_CMD src/index.js dist/react-redux.min.js diff --git a/scripts/build b/scripts/build deleted file mode 100755 index 50a3a47dc..000000000 --- a/scripts/build +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -e - -rm -rf lib -`npm bin`/babel src --out-dir lib diff --git a/scripts/clean b/scripts/clean deleted file mode 100755 index 4f674f6e1..000000000 --- a/scripts/clean +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -`npm bin`/rimraf ./lib diff --git a/scripts/lint b/scripts/lint deleted file mode 100755 index fb2aaaa77..000000000 --- a/scripts/lint +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -`npm bin`/eslint src test diff --git a/scripts/prepublish b/scripts/prepublish deleted file mode 100755 index 00260c55f..000000000 --- a/scripts/prepublish +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -e - -sh scripts/lint -sh scripts/clean -sh scripts/browser -sh scripts/build diff --git a/scripts/test b/scripts/test deleted file mode 100755 index 8f4715ad6..000000000 --- a/scripts/test +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -NODE_ENV=test `npm bin`/mocha --compilers js:babel/register --recursive \ No newline at end of file diff --git a/scripts/test-cov b/scripts/test-cov deleted file mode 100755 index 3389f9cab..000000000 --- a/scripts/test-cov +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -`npm bin`/istanbul cover `npm bin`/_mocha -- --compilers js:babel/register --recursive \ No newline at end of file diff --git a/scripts/test-watch b/scripts/test-watch deleted file mode 100755 index ce4725bed..000000000 --- a/scripts/test-watch +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -NODE_ENV=test `npm bin`/mocha --compilers js:babel/register --recursive --watch \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.base.js similarity index 61% rename from webpack.config.js rename to webpack.config.base.js index 353f6df3d..0b7cd4867 100644 --- a/webpack.config.js +++ b/webpack.config.base.js @@ -2,24 +2,6 @@ var webpack = require('webpack'); -var plugins = [ - new webpack.DefinePlugin({ - 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) - }), - new webpack.optimize.OccurenceOrderPlugin() -]; - -if (process.env.NODE_ENV === 'production') { - plugins.push( - new webpack.optimize.UglifyJsPlugin({ - compressor: { - screw_ie8: true, - warnings: false - } - }) - ); -} - var reactExternal = { root: 'React', commonjs2: 'react', @@ -49,7 +31,6 @@ module.exports = { library: 'ReactRedux', libraryTarget: 'umd' }, - plugins: plugins, resolve: { extensions: ['', '.js'] } diff --git a/webpack.config.development.js b/webpack.config.development.js new file mode 100644 index 000000000..e509d7cd2 --- /dev/null +++ b/webpack.config.development.js @@ -0,0 +1,14 @@ +'use strict'; + +var webpack = require('webpack'); +var baseConfig = require('./webpack.config.base'); + +var config = Object.create(baseConfig); +config.plugins = [ + new webpack.optimize.OccurenceOrderPlugin(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('development') + }) +]; + +module.exports = config; diff --git a/webpack.config.production.js b/webpack.config.production.js new file mode 100644 index 000000000..f4589cc06 --- /dev/null +++ b/webpack.config.production.js @@ -0,0 +1,20 @@ +'use strict'; + +var webpack = require('webpack'); +var baseConfig = require('./webpack.config.base'); + +var config = Object.create(baseConfig); +config.plugins = [ + new webpack.optimize.OccurenceOrderPlugin(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('production') + }), + new webpack.optimize.UglifyJsPlugin({ + compressor: { + screw_ie8: true, + warnings: false + } + }) +]; + +module.exports = config;