Skip to content

Commit b0a7d05

Browse files
ayusharmaefegurkan
authored andcommitted
chore: migrate to babel-preset-env (trivago#50) (trivago#51)
1 parent 06fb3b4 commit b0a7d05

File tree

6 files changed

+217
-233
lines changed

6 files changed

+217
-233
lines changed

.babelrc

+33-7
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,50 @@
11
{
22
"plugins": [
33
"transform-flow-strip-types",
4+
"transform-object-rest-spread",
45
"lodash"
56
],
67
"env": {
78
"development": {
8-
"presets": [["es2015", {modules: false, loose: true}], "stage-1", "react"],
9+
"presets": [
10+
[
11+
"env",
12+
{
13+
"modules": false,
14+
"loose": true
15+
}
16+
],
17+
"react"
18+
]
919
},
1020
"production": {
11-
"presets": [["es2015", {modules: false, loose: true}], "stage-1", "react"],
21+
"presets": [
22+
[
23+
"env",
24+
{
25+
"modules": false,
26+
"loose": true
27+
}
28+
],
29+
"react"
30+
],
1231
"plugins": ["transform-inline-environment-variables"]
1332
},
1433
"release": {
15-
"presets": [["es2015", {modules: false, loose: true}], "stage-1", "react"],
34+
"presets": [
35+
[
36+
"env",
37+
{
38+
"modules": false,
39+
"loose": true
40+
}
41+
],
42+
"react"
43+
]
1644
},
1745
"test": {
18-
"presets": ["node6", "stage-1"],
19-
"plugins": [
20-
"transform-inline-environment-variables"
21-
]
46+
"presets": ["env"],
47+
"plugins": ["transform-inline-environment-variables"]
2248
}
2349
}
2450
}

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Added PR template
55
- Fix rollup config to generate esm properly [#42](https://github.com/trivago/melody/pull/42)
66
- Added `testURL` in Jest config. [#49](https://github.com/trivago/melody/pull/49)
7+
- Migation to `babel-preset-env`. [#50](https://github.com/trivago/melody/issues/50)
78

89
## 1.1.0
910

package.json

+8-9
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,18 @@
3535
"@types/lodash": "^4.14.54",
3636
"@types/node": "^7.0.7",
3737
"babel-cli": "^6.23.0",
38+
"babel-core": "^6.26.3",
3839
"babel-eslint": "^7.1.1",
3940
"babel-jest": "^22.0.6",
41+
"babel-plugin-external-helpers": "^6.22.0",
4042
"babel-plugin-lodash": "^3.2.11",
4143
"babel-plugin-transform-flow-strip-types": "^6.22.0",
4244
"babel-plugin-transform-inline-environment-variables": "^6.8.0",
45+
"babel-plugin-transform-object-rest-spread": "^6.26.0",
4346
"babel-plugin-transform-runtime": "^6.23.0",
4447
"babel-polyfill": "^6.16.0",
45-
"babel-preset-es2015": "^6.22.0",
46-
"babel-preset-es2015-loose": "8.0.0",
47-
"babel-preset-es2015-minimal-rollup": "^2.1.1",
48-
"babel-preset-node6": "^11.0.0",
48+
"babel-preset-env": "^1.7.0",
4949
"babel-preset-react": "^6.23.0",
50-
"babel-preset-stage-1": "^6.22.0",
5150
"babel-register": "^6.23.0",
5251
"bundlesize": "^0.13.2",
5352
"chai": "^3.0.0",
@@ -71,9 +70,9 @@
7170
"redux-thunk": "^2.2.0",
7271
"rimraf": "^2.6.1",
7372
"rollup": "^0.63.5",
74-
"rollup-plugin-babel": "^2.7.1",
75-
"rollup-plugin-json": "^2.1.0",
76-
"rollup-plugin-uglify": "^2.0.1",
73+
"rollup-plugin-babel": "^3.0.7",
74+
"rollup-plugin-json": "^3.0.0",
75+
"rollup-plugin-uglify": "^4.0.0",
7776
"sinon": "^1.17.7",
7877
"sinon-chai": "^2.8.0",
7978
"source-map": "^0.5.6",
@@ -89,7 +88,7 @@
8988
"bundlesize": [
9089
{
9190
"path": "./packages/melody-component/lib/index.js",
92-
"maxSize": "1.09 kB"
91+
"maxSize": "1.10 kB"
9392
},
9493
{
9594
"path": "./packages/melody-idom/lib/index.js",

packages/melody-jest-transform/__tests__/customTransformSpec.js

+20-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,16 @@ jest.mock('find-babel-config', () => ({
2424
config: {
2525
env: {
2626
test: {
27-
presets: ['node6', 'stage-1'],
27+
presets: [
28+
[
29+
'env',
30+
{
31+
targets: {
32+
node: '6',
33+
},
34+
},
35+
],
36+
],
2837
plugins: ['transform-inline-environment-variables'],
2938
},
3039
},
@@ -67,7 +76,16 @@ describe('Custom transformer', () => {
6776
const babel = {
6877
env: {
6978
test: {
70-
presets: ['node6', 'stage-1'],
79+
presets: [
80+
[
81+
'env',
82+
{
83+
targets: {
84+
node: '6',
85+
},
86+
},
87+
],
88+
],
7189
plugins: ['transform-inline-environment-variables'],
7290
},
7391
},

rollup.config.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from 'fs';
22
import path from 'path';
33
import babel from 'rollup-plugin-babel';
44
import json from 'rollup-plugin-json';
5-
import uglify from 'rollup-plugin-uglify';
5+
import { uglify } from 'rollup-plugin-uglify';
66

77
// reads package.json of packages (melody-*) in packages directory
88
const pkg = fs.readFileSync(path.join(process.cwd(), './package.json'));
@@ -18,7 +18,13 @@ const config = {
1818
format: 'cjs',
1919
},
2020
],
21-
plugins: [json(), babel()],
21+
plugins: [
22+
json(),
23+
babel({
24+
exclude: 'node_modules/**',
25+
plugins: ['external-helpers'],
26+
}),
27+
],
2228
external: [
2329
...Object.keys(pkgJSON.dependencies || {}),
2430
...Object.keys(pkgJSON.peerDependencies || {}),

0 commit comments

Comments
 (0)