Skip to content

Commit 1b9e6b7

Browse files
committed
Update dependencies and make changes for Babel 7
1 parent 711d08d commit 1b9e6b7

File tree

6 files changed

+1097
-804
lines changed

6 files changed

+1097
-804
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ umd
77
!rollup.config.js
88
*.sublime-project
99
*.sublime-workspace
10+
yarn-error.log

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"clean": "rm -f index.js && rm -rf es && rm -rf umd",
2222
"prebuild": "npm run clean",
2323
"build": "node ./tools/build.js",
24-
"watch": "babel ./src -d . --ignore __tests__ --watch",
24+
"watch": "babel ./src -d . --ignore __tests__,*.test.js --watch",
2525
"prepare": "npm run build",
2626
"prepublishOnly": "node ./tools/build.js",
2727
"push-release": "git push origin master && git push --tags",
@@ -37,15 +37,16 @@
3737
"prop-types": "^15.6.2"
3838
},
3939
"devDependencies": {
40-
"babel-cli": "^6.24.1",
41-
"babel-core": "^6.26.0",
40+
"@babel/cli": "^7.0.0",
41+
"@babel/core": "^7.0.0",
42+
"@babel/plugin-external-helpers": "^7.0.0",
43+
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
44+
"@babel/preset-env": "^7.0.0",
45+
"@babel/preset-react": "^7.0.0",
46+
"babel-core": "^7.0.0-0",
4247
"babel-jest": "^23.4.0",
4348
"babel-plugin-dev-expression": "^0.2.1",
44-
"babel-plugin-external-helpers": "^6.22.0",
45-
"babel-plugin-transform-object-rest-spread": "^6.23.0",
4649
"babel-plugin-transform-react-remove-prop-types": "^0.4.13",
47-
"babel-preset-env": "^1.6.1",
48-
"babel-preset-react": "^6.24.1",
4950
"coveralls": "^3.0.2",
5051
"enzyme": "^3.5.0",
5152
"enzyme-adapter-react-16": "^1.3.1",

rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const config = {
2525
plugins: [
2626
babel({
2727
exclude: 'node_modules/**',
28+
externalHelpers: process.env.BABEL_ENV === 'umd',
2829
}),
2930
resolve(),
3031
commonjs({

tools/babel-preset.js

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,30 @@ const BABEL_ENV = process.env.BABEL_ENV;
22
const building = BABEL_ENV != undefined && BABEL_ENV !== 'cjs';
33

44
const plugins = [
5-
'transform-object-rest-spread',
5+
'@babel/plugin-proposal-object-rest-spread',
66
];
77

8-
if (BABEL_ENV === 'umd') {
9-
plugins.push('external-helpers');
10-
}
11-
128
if (process.env.NODE_ENV === 'production') {
139
plugins.push(
14-
'dev-expression',
15-
'transform-react-remove-prop-types'
10+
'babel-plugin-dev-expression',
11+
'babel-plugin-transform-react-remove-prop-types'
1612
);
1713
}
1814

19-
module.exports = {
20-
env: {
21-
test: {
22-
presets: [['env'], 'react'],
15+
module.exports = () => {
16+
return {
17+
env: {
18+
test: {
19+
presets: [['@babel/preset-env'], '@babel/preset-react'],
20+
},
2321
},
24-
},
25-
presets: [
26-
['env', {
27-
'loose': true,
28-
'modules': building ? false : 'commonjs'
29-
}],
30-
'react'
31-
],
32-
plugins: plugins
22+
presets: [
23+
['@babel/preset-env', {
24+
'loose': true,
25+
'modules': building ? false : 'commonjs'
26+
}],
27+
'@babel/preset-react'
28+
],
29+
plugins: plugins,
30+
};
3331
};

tools/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ const exec = (command, extraEnv) => {
1212

1313
console.log('Building CommonJS modules ...');
1414

15-
exec('babel src -d . --ignore __tests__,*.test.js', {
15+
exec('babel src -d . --ignore __tests__,**/*.test.js', {
1616
BABEL_ENV: 'cjs',
1717
});
1818

1919
console.log('\nBuilding ES modules ...');
2020

21-
exec('babel src -d es --ignore __tests__,*.test.js', {
21+
exec('babel src -d es --ignore __tests__,**/*.test.js', {
2222
BABEL_ENV: 'es',
2323
});
2424

0 commit comments

Comments
 (0)