Skip to content

Commit 97dcac6

Browse files
committed
Added es build, which will get beneficial for es2015 modules aware bundlers like webpack 2+ and rollup
1 parent 780e8e5 commit 97dcac6

File tree

5 files changed

+674
-701
lines changed

5 files changed

+674
-701
lines changed

.babelrc

Lines changed: 1 addition & 11 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" }]
3+
"./.babelrc.js"
144
]
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 }

package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,24 @@
33
"version": "2.3.1",
44
"description": "A react component toolset for managing animations",
55
"main": "lib/index.js",
6+
"module": "es/index.js",
67
"scripts": {
78
"test": "npm run lint && npm run testonly",
89
"testonly": "jest --verbose",
910
"tdd": "jest --watch",
1011
"commitmsg": "commitlint -e $GIT_PARAMS",
11-
"build": "rimraf lib && babel src --out-dir lib && npm run build:dist && cp README.md LICENSE ./lib",
12+
"prebuild": "rimraf lib es dist",
13+
"build": "npm run build:cjs && npm run build:es && npm run build:dist",
14+
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
15+
"build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir lib",
16+
"build:dist": "webpack && NODE_ENV=production webpack -p",
1217
"build:docs": "npm -C www run build",
13-
"build:dist": "rimraf lib/dist && webpack && NODE_ENV=production webpack -p",
1418
"bootstrap": "yarn && yarn --cwd www",
1519
"lint": "eslint src test",
20+
"prerelease": "cherry-pick",
1621
"release": "release",
17-
"release:next": "release --preid beta --tag next",
22+
"release:next": "npm run release -- --preid beta --tag next",
23+
"postrelease": "cherry-pick clean",
1824
"deploy-docs": "npm -C www run deploy",
1925
"start": "npm -C www run develop",
2026
"storybook": "start-storybook -p 6006",
@@ -83,6 +89,8 @@
8389
"babel-preset-latest": "^6.24.0",
8490
"babel-preset-react": "^6.23.0",
8591
"babel-preset-stage-2": "^6.18.0",
92+
"cherry-pick": "^0.2.0",
93+
"cross-env": "^5.0.1",
8694
"enzyme": "^3.0.0",
8795
"enzyme-adapter-react-16": "^1.0.0",
8896
"eslint": "^3.17.1",
@@ -100,7 +108,6 @@
100108
"release-script": "^1.0.2",
101109
"rimraf": "^2.6.1",
102110
"semantic-release": "^15.1.7",
103-
"semantic-release-alt-publish-dir": "^2.1.1",
104111
"sinon": "^2.1.0",
105112
"travis-deploy-once": "^4.4.1",
106113
"webpack": "^3.6.0",
@@ -110,13 +117,11 @@
110117
"pkgRoot": "lib",
111118
"verifyConditions": [
112119
"@semantic-release/changelog",
113-
"semantic-release-alt-publish-dir",
114120
"@semantic-release/git",
115121
"@semantic-release/github"
116122
],
117123
"prepare": [
118124
"@semantic-release/changelog",
119-
"semantic-release-alt-publish-dir",
120125
"@semantic-release/npm",
121126
"@semantic-release/git"
122127
]

src/index.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
import CSSTransition from './CSSTransition';
2-
import ReplaceTransition from './ReplaceTransition';
3-
import TransitionGroup from './TransitionGroup';
4-
import Transition from './Transition';
5-
6-
7-
module.exports = {
8-
Transition,
9-
TransitionGroup,
10-
ReplaceTransition,
11-
CSSTransition,
12-
};
1+
export { default as CSSTransition } from './CSSTransition';
2+
export { default as ReplaceTransition } from './ReplaceTransition';
3+
export { default as TransitionGroup } from './TransitionGroup';
4+
export { default as Transition } from './Transition';

0 commit comments

Comments
 (0)