Skip to content

Commit 462af90

Browse files
committed
Added es build, which will get beneficial for es2015 modules aware bundlers like webpack 2+ and rollup
1 parent 129f4e4 commit 462af90

File tree

9 files changed

+101
-23
lines changed

9 files changed

+101
-23
lines changed

.babelrc

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
{
22
"presets": [
3-
["latest", {
4-
"es2015": { "loose": true }
5-
}],
6-
"stage-2",
7-
"react"
8-
],
9-
"plugins": [
10-
"dev-expression",
11-
"add-module-exports",
12-
"transform-object-assign",
13-
["transform-react-remove-prop-types", { mode: "wrap" }]
14-
],
3+
"./.babelrc.js"
4+
]
155
}

.babelrc.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const modules = process.env.BABEL_ENV === 'es' ? false : 'commonjs'
2+
3+
const presets = [
4+
['latest', {
5+
es2015: { loose: true, modules }
6+
}],
7+
'stage-2',
8+
'react'
9+
]
10+
11+
const plugins = [
12+
'dev-expression',
13+
'add-module-exports',
14+
'transform-object-assign',
15+
['transform-react-remove-prop-types', { mode: 'wrap' }]
16+
]
17+
18+
module.exports = { plugins, presets }

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/es
12
/lib
23

34
# Logs

CSSTransition/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "react-transition-group/CSSTransition",
3+
"private": true,
4+
"main": "../lib/CSSTransition.js",
5+
"module": "../es/CSSTransition.js",
6+
"jsnext:main": "../es/CSSTransition.js"
7+
}

Transition/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "react-transition-group/Transition",
3+
"private": true,
4+
"main": "../lib/Transition.js",
5+
"module": "../es/Transition.js",
6+
"jsnext:main": "../es/Transition.js"
7+
}

TransitionGroup/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "react-transition-group/TransitionGroup",
3+
"private": true,
4+
"main": "../lib/TransitionGroup.js",
5+
"module": "../es/TransitionGroup.js",
6+
"jsnext:main": "../es/TransitionGroup.js"
7+
}

package.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,21 @@
33
"version": "2.0.0-beta.0",
44
"description": "A react component toolset for managing animations",
55
"main": "lib/index.js",
6+
"module": "es/index.js",
7+
"jsnext:main": "es/index.js",
8+
"files": [
9+
"es",
10+
"lib",
11+
"CSSTransition",
12+
"Transition",
13+
"TransitionGroup"
14+
],
615
"scripts": {
716
"test": "jest --runInBand --verbose",
817
"tdd": "jest --watch",
9-
"build": "rimraf lib && babel src --out-dir lib && npm run build:dist",
18+
"build": "rimraf es lib && npm run build:es && npm run build:cjs && npm run build:dist",
19+
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
20+
"build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir lib",
1021
"build:dist": "rimraf lib/dist && webpack && NODE_ENV=production webpack -p",
1122
"lint": "eslint src test",
1223
"release": "release",
@@ -65,6 +76,7 @@
6576
"babel-preset-latest": "^6.24.0",
6677
"babel-preset-react": "^6.23.0",
6778
"babel-preset-stage-2": "^6.18.0",
79+
"cross-env": "^5.0.1",
6880
"css-literal-loader": "^0.2.0",
6981
"css-loader": "^0.28.0",
7082
"eslint": "^3.17.1",
@@ -82,9 +94,6 @@
8294
"teaspoon": "^6.4.3",
8395
"webpack": "^2.2.1"
8496
},
85-
"release-script": {
86-
"altPkgRootFolder": "lib"
87-
},
8897
"browserify": {
8998
"transform": [
9099
"loose-envify"

src/index.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,4 @@ import CSSTransition from './CSSTransition';
22
import TransitionGroup from './TransitionGroup';
33
import Transition from './Transition';
44

5-
6-
module.exports = {
7-
Transition,
8-
TransitionGroup,
9-
CSSTransition,
10-
};
5+
export { Transition, TransitionGroup, CSSTransition }

yarn.lock

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1758,6 +1758,21 @@ create-react-class@^15.5.2:
17581758
fbjs "^0.8.9"
17591759
object-assign "^4.1.1"
17601760

1761+
cross-env@^5.0.1:
1762+
version "5.0.1"
1763+
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.0.1.tgz#ff4e72ea43b47da2486b43a7f2043b2609e44913"
1764+
dependencies:
1765+
cross-spawn "^5.1.0"
1766+
is-windows "^1.0.0"
1767+
1768+
cross-spawn@^5.1.0:
1769+
version "5.1.0"
1770+
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
1771+
dependencies:
1772+
lru-cache "^4.0.1"
1773+
shebang-command "^1.2.0"
1774+
which "^1.2.9"
1775+
17611776
17621777
version "2.0.5"
17631778
resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8"
@@ -3170,6 +3185,10 @@ is-utf8@^0.2.0:
31703185
version "0.2.1"
31713186
resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"
31723187

3188+
is-windows@^1.0.0:
3189+
version "1.0.1"
3190+
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.1.tgz#310db70f742d259a16a369202b51af84233310d9"
3191+
31733192
31743193
version "0.0.1"
31753194
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
@@ -3724,6 +3743,13 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1:
37243743
dependencies:
37253744
js-tokens "^3.0.0"
37263745

3746+
lru-cache@^4.0.1:
3747+
version "4.1.1"
3748+
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55"
3749+
dependencies:
3750+
pseudomap "^1.0.2"
3751+
yallist "^2.1.2"
3752+
37273753
macaddress@^0.2.8:
37283754
version "0.2.8"
37293755
resolved "https://registry.yarnpkg.com/macaddress/-/macaddress-0.2.8.tgz#5904dc537c39ec6dbefeae902327135fa8511f12"
@@ -4628,6 +4654,10 @@ prr@~0.0.0:
46284654
version "0.0.0"
46294655
resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a"
46304656

4657+
pseudomap@^1.0.2:
4658+
version "1.0.2"
4659+
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
4660+
46314661
public-encrypt@^4.0.0:
46324662
version "4.0.0"
46334663
resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.0.tgz#39f699f3a46560dd5ebacbca693caf7c65c18cc6"
@@ -5145,6 +5175,16 @@ [email protected], shallowequal@^0.2.2:
51455175
dependencies:
51465176
lodash.keys "^3.1.2"
51475177

5178+
shebang-command@^1.2.0:
5179+
version "1.2.0"
5180+
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
5181+
dependencies:
5182+
shebang-regex "^1.0.0"
5183+
5184+
shebang-regex@^1.0.0:
5185+
version "1.0.0"
5186+
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
5187+
51485188
shelljs@^0.5.1:
51495189
version "0.5.3"
51505190
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.5.3.tgz#c54982b996c76ef0c1e6b59fbdc5825f5b713113"
@@ -5828,7 +5868,7 @@ which-module@^1.0.0:
58285868
version "1.0.0"
58295869
resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f"
58305870

5831-
which@^1.2.12:
5871+
which@^1.2.12, which@^1.2.9:
58325872
version "1.2.14"
58335873
resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5"
58345874
dependencies:
@@ -5906,6 +5946,10 @@ y18n@^3.2.0, y18n@^3.2.1:
59065946
version "3.2.1"
59075947
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
59085948

5949+
yallist@^2.1.2:
5950+
version "2.1.2"
5951+
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
5952+
59095953
yargs-parser@^4.2.0:
59105954
version "4.2.1"
59115955
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c"

0 commit comments

Comments
 (0)