Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ES Modules build #1369

Merged
merged 1 commit into from
Feb 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
plugins: [
"plugins": [
["transform-es2015-template-literals", { "loose": true }],
"transform-es2015-literals",
"transform-es2015-function-name",
Expand All @@ -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 }]
]
}
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
node_modules
dist
lib
es
coverage
_book
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question @gaearon, what (if anything) are you defining under BABEL_ENV=es? Or is it a placeholder for stuff to come or an indicator of the mode? Thanks :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just left it for consistency so I always specify either that, or commonjs. Indeed it is not currently used explicitly anywhere.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff :) thanks for the clarification!
On Fri 5 Feb 2016 at 23:51 Dan Abramov notifications@github.com wrote:

In package.json
#1369 (comment):

 "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",

I just left it for consistency so I always specify either that, or
commonjs. Indeed it is not currently used explicitly anywhere.


Reply to this email directly or view it on GitHub
https://github.com/rackt/redux/pull/1369/files#r52088759.

"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",
Expand Down
2 changes: 1 addition & 1 deletion prepublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down