Permalink
Browse files

Add ES Modules build

  • Loading branch information...
1 parent 511fe67 commit b27cb480bca24c0bff732370d6c2bfce4f894caa @gaearon gaearon committed Feb 5, 2016
Showing with 25 additions and 16 deletions.
  1. +9 −3 .babelrc
  2. +1 −0 .gitignore
  3. +1 −1 .travis.yml
  4. +13 −11 package.json
  5. +1 −1 prepublish.js
View
@@ -1,5 +1,5 @@
{
- plugins: [
+ "plugins": [
["transform-es2015-template-literals", { "loose": true }],
"transform-es2015-literals",
"transform-es2015-function-name",
@@ -17,7 +17,13 @@
"transform-es2015-parameters",
["transform-es2015-destructuring", { "loose": true }],
"transform-es2015-block-scoping",
- ["transform-es2015-modules-commonjs", { "loose": true }],
"transform-object-rest-spread"
- ]
+ ],
+ "env": {
+ "commonjs": {
+ "plugins": [
+ ["transform-es2015-modules-commonjs", { "loose": true }]
+ ]
+ }
+ }
}
View
@@ -3,5 +3,6 @@
node_modules
dist
lib
+es
coverage
_book
View
@@ -3,7 +3,7 @@ node_js:
- "4"
- "5"
script:
- - npm run check:lib
+ - npm run check:src
- npm run build
- npm run check:examples
branches:
View
@@ -3,27 +3,29 @@
"version": "3.2.1",
"description": "Predictable state container for JavaScript apps",
"main": "lib/index.js",
- "jsnext:main": "src/index.js",
+ "jsnext:main": "es/index.js",
"files": [
"dist",
"lib",
+ "es",
"src"
],
"scripts": {
"clean": "rimraf lib dist coverage",
"lint": "eslint src test examples",
- "test": "mocha --compilers js:babel-register --recursive",
+ "test": "cross-env BABEL_ENV=commonjs mocha --compilers js:babel-register --recursive",
"test:watch": "npm test -- --watch",
- "test:cov": "babel-node $(npm bin)/isparta cover $(npm bin)/_mocha -- --recursive",
- "test:examples": "babel-node examples/testAll.js",
- "check:lib": "npm run lint && npm run test",
+ "test:cov": "cross-env BABEL_ENV=commonjs babel-node $(npm bin)/isparta cover $(npm bin)/_mocha -- --recursive",
+ "test:examples": "cross-env BABEL_ENV=commonjs babel-node examples/testAll.js",
+ "check:src": "npm run lint && npm run test",
"check:examples": "npm run build:examples && npm run test:examples",
- "build:lib": "babel src --out-dir lib",
- "build:umd": "cross-env NODE_ENV=development webpack src/index.js dist/redux.js",
- "build:umd:min": "cross-env NODE_ENV=production webpack src/index.js dist/redux.min.js",
- "build:examples": "babel-node examples/buildAll.js",
- "build": "npm run build:lib && npm run build:umd && npm run build:umd:min && node ./prepublish",
- "prepublish": "npm run clean && npm run check:lib && npm run build",
+ "build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
+ "build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
+ "build:umd": "cross-env BABEL_ENV=commonjs NODE_ENV=development webpack src/index.js dist/redux.js",
+ "build:umd:min": "cross-env BABEL_ENV=commonjs NODE_ENV=production webpack src/index.js dist/redux.min.js",
+ "build:examples": "cross-env BABEL_ENV=commonjs babel-node examples/buildAll.js",
+ "build": "npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min && node ./prepublish",
+ "prepublish": "npm run clean && npm run check:src && npm run build",
"docs:clean": "rimraf _book",
"docs:prepare": "gitbook install",
"docs:build": "npm run docs:prepare && gitbook build -g rackt/redux",
View
@@ -2,7 +2,7 @@ var glob = require('glob')
var fs = require('fs')
var es3ify = require('es3ify')
-glob('./@(lib|dist)/**/*.js', function (err, files) {
+glob('./@(lib|dist|es)/**/*.js', function (err, files) {
if (err) {
throw err
}

0 comments on commit b27cb48

Please sign in to comment.