Skip to content

Commit d5b6fba

Browse files
authored
Upgrade to Babel 7 (#113)
* build: upgrade to babel 7 * Load babelrc in storybook
1 parent 94a8222 commit d5b6fba

File tree

6 files changed

+2091
-1396
lines changed

6 files changed

+2091
-1396
lines changed

.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-flow"],
3+
"plugins": ["@babel/plugin-proposal-class-properties"]
4+
}

.babelrc.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ npm-debug.log
1818
.eslintignore
1919
.flowconfig
2020
.travis.yml
21-
.babelrc.js
21+
.babelrc
2222
.editorconfig
2323
.storybook
2424
yarn.lock

package.json

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@
6060
"insilico"
6161
]
6262
},
63-
"babel": {
64-
"presets": [
65-
"./.babelrc.js"
66-
]
67-
},
6863
"jest": {
6964
"testEnvironment": "jsdom",
7065
"snapshotSerializers": [
@@ -85,40 +80,50 @@
8580
"react": "^15.0.0 || ^16.0.0 || ^17.0.0"
8681
},
8782
"devDependencies": {
88-
"@storybook/addon-actions": "^3.4.8",
89-
"@storybook/addon-options": "^3.4.8",
90-
"@storybook/react": "^3.4.8",
91-
"babel-cli": "^6.24.1",
92-
"babel-core": "^6.26.3",
93-
"babel-jest": "^23.0.0",
94-
"babel-plugin-external-helpers": "^6.22.0",
95-
"babel-preset-env": "^1.7.0",
96-
"babel-preset-react": "^6.24.1",
97-
"babel-preset-stage-2": "^6.24.1",
98-
"babel-runtime": "^6.25.0",
83+
"@babel/cli": "^7.0.0",
84+
"@babel/core": "^7.0.0",
85+
"@babel/plugin-external-helpers": "^7.0.0",
86+
"@babel/plugin-proposal-class-properties": "^7.0.0",
87+
"@babel/plugin-proposal-decorators": "^7.0.0",
88+
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
89+
"@babel/plugin-proposal-function-sent": "^7.0.0",
90+
"@babel/plugin-proposal-json-strings": "^7.0.0",
91+
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
92+
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
93+
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
94+
"@babel/plugin-syntax-import-meta": "^7.0.0",
95+
"@babel/preset-env": "^7.0.0",
96+
"@babel/preset-flow": "^7.0.0",
97+
"@babel/preset-react": "^7.0.0",
98+
"@babel/runtime": "^7.0.0",
99+
"@storybook/addon-actions": "^3.4.10",
100+
"@storybook/addon-options": "^3.4.10",
101+
"@storybook/react": "^3.4.10",
102+
"babel-core": "^7.0.0-bridge.0",
103+
"babel-jest": "^23.4.2",
99104
"concurrently": "4.0.1",
100-
"coveralls": "^3.0.1",
105+
"coveralls": "^3.0.2",
101106
"enzyme": "^3.4.4",
102-
"enzyme-adapter-react-16": "^1.2.0",
107+
"enzyme-adapter-react-16": "^1.3.1",
103108
"enzyme-to-json": "^3.3.4",
104-
"eslint": "^5.0.0",
109+
"eslint": "^5.5.0",
105110
"eslint-config-insilico": "^5.2.0",
106-
"flow-bin": "^0.79.0",
107-
"flow-copy-source": "^2.0.0",
111+
"flow-bin": "^0.80.0",
112+
"flow-copy-source": "^2.0.2",
108113
"husky": "^0.14.3",
109114
"intersection-observer": "^0.5.0",
110-
"jest": "^23.1.0",
111-
"lint-staged": "^7.2.0",
115+
"jest": "^23.5.0",
116+
"lint-staged": "^7.2.2",
112117
"npm-run-all": "^4.1.3",
113-
"prettier": "^1.13.5",
114-
"react": "^16.4.1",
115-
"react-dom": "^16.4.1",
116-
"react-test-renderer": "^16.4.1",
118+
"prettier": "^1.14.2",
119+
"react": "^16.4.2",
120+
"react-dom": "^16.4.2",
121+
"react-test-renderer": "^16.4.2",
117122
"rollup": "^0.65.0",
118-
"rollup-plugin-babel": "^3.0.5",
119-
"rollup-plugin-commonjs": "^9.1.0",
123+
"rollup-plugin-babel": "^4.0.1",
124+
"rollup-plugin-commonjs": "^9.1.6",
120125
"rollup-plugin-node-resolve": "^3.3.0",
121126
"rollup-plugin-replace": "^2.0.0",
122-
"rollup-plugin-uglify": "^4.0.0"
127+
"rollup-plugin-uglify": "^5.0.2"
123128
}
124129
}

rollup.config.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ const umd = format === 'umd'
1212
const cjs = format === 'cjs'
1313

1414
let output
15+
let targets = {}
1516

1617
if (es) {
1718
output = { file: pkg.module, format: 'es' }
19+
targets = {
20+
node: true,
21+
}
1822
} else if (umd) {
1923
if (minify) {
2024
output = {
@@ -56,9 +60,16 @@ export default [
5660
commonjs({ include: 'node_modules/**' }),
5761
babel({
5862
exclude: 'node_modules/**',
59-
babelrc: false,
60-
presets: [['env', { loose: true, modules: false }], 'react', 'stage-2'],
61-
plugins: ['external-helpers'],
63+
externalHelpers: false,
64+
presets: [
65+
[
66+
'@babel/preset-env',
67+
{
68+
loose: true,
69+
targets,
70+
},
71+
],
72+
],
6273
}),
6374
umd
6475
? replace({

0 commit comments

Comments
 (0)