Skip to content
This repository was archived by the owner on Jan 4, 2018. It is now read-only.

Commit 59b5b87

Browse files
committed
Migrate to babel 6
1 parent fdd0554 commit 59b5b87

File tree

10 files changed

+65
-45
lines changed

10 files changed

+65
-45
lines changed

.babelrc

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
{
2-
"optional": ["runtime"],
3-
"stage": 0,
2+
"plugins": [ "transform-decorators", "transform-runtime" ],
3+
"presets": [ "es2015", "react", "stage-0" ],
44
"env": {
55
"development": {
6-
"plugins": ["react-transform"],
7-
"extra": {
8-
"react-transform": {
9-
"transforms": [{
10-
"transform": "react-transform-hmr",
11-
"imports": ["react"],
12-
"locals": ["module"]
13-
}]
14-
}
15-
}
6+
"plugins": [
7+
[ "react-transform", {
8+
"transforms": [
9+
{
10+
"transform": "react-transform-hmr",
11+
"imports": ["react"],
12+
"locals": ["module"]
13+
},
14+
{
15+
"transform": "react-transform-catch-errors",
16+
"imports": [ "react", "redbox-react" ]
17+
}
18+
]
19+
}]
20+
]
1621
}
1722
}
1823
}

lib/Root.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ function logout (nextState, replaceState) {
9090
replaceState({}, '/login')
9191
}
9292

93-
@connect(({ application }) => ({ application }))
94-
export default class Root extends React.Component {
93+
class Root extends React.Component {
9594
static propTypes = {
9695
application: PropTypes.object.isRequired
9796
}
@@ -102,3 +101,5 @@ export default class Root extends React.Component {
102101
)
103102
}
104103
}
104+
105+
export default connect(({ application }) => ({ application }))(Root)

lib/components/Menu.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ const menuItems = [
1313
{ text: 'Fork Me', link: GITHUB_REPO, icon: 'fa fa-github', isExternal: true }
1414
]
1515

16-
@connect(({ application }) => ({ application }), applicationActions)
17-
export default class Menu extends React.Component {
16+
class Menu extends React.Component {
1817

1918
static propTypes = {
2019
activeClass: PropTypes.string.isRequired,
@@ -58,3 +57,8 @@ export default class Menu extends React.Component {
5857
)
5958
}
6059
}
60+
61+
export default connect(
62+
({ application }) => ({ application }),
63+
applicationActions
64+
)(Menu)

lib/components/github/Repo.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ import { fetchOnUpdate } from '../../decorators'
44
import StargazersUser from './StargazersUser'
55
import Pagination from './Pagination'
66

7-
@fetchOnUpdate([ 'username', 'repo' ], (params, actions) => {
8-
const { username, repo } = params
9-
actions.fetchRepo({ username, repo })
10-
actions.fetchRepoStargazers({ username, repo })
11-
})
12-
export default class Repo extends React.Component {
7+
class Repo extends React.Component {
138

149
static propTypes = {
1510
actions: PropTypes.object,
@@ -87,3 +82,9 @@ export default class Repo extends React.Component {
8782
)
8883
}
8984
}
85+
86+
export default fetchOnUpdate([ 'username', 'repo' ], (params, actions) => {
87+
const { username, repo } = params
88+
actions.fetchRepo({ username, repo })
89+
actions.fetchRepoStargazers({ username, repo })
90+
})(Repo)

lib/components/github/User.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ import { fetchOnUpdate } from '../../decorators'
44
import StargazersRepo from './StargazersRepo'
55
import Pagination from './Pagination'
66

7-
@fetchOnUpdate(['username'], (params, actions) => {
8-
const { username } = params
9-
actions.fetchUser({ username })
10-
actions.fetchUserStargazers({ username })
11-
})
12-
export default class User extends React.Component {
7+
class User extends React.Component {
138

149
static propTypes = {
1510
actions: PropTypes.object,
@@ -67,3 +62,9 @@ export default class User extends React.Component {
6762
)
6863
}
6964
}
65+
66+
export default fetchOnUpdate(['username'], (params, actions) => {
67+
const { username } = params
68+
actions.fetchUser({ username })
69+
actions.fetchUserStargazers({ username })
70+
})(User)

lib/components/pages/GithubStargazers.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@ const messages = defineMessages({
1313
}
1414
})
1515

16-
@connect(state => ({
17-
github: state.github
18-
}), dispatch => ({
19-
actions: bindActionCreators(githubActions, dispatch)
20-
}))
21-
export default class GithubStargazers extends React.Component {
16+
class GithubStargazers extends React.Component {
2217

2318
static propTypes = {
2419
children: PropTypes.any,
@@ -44,3 +39,8 @@ export default class GithubStargazers extends React.Component {
4439
)
4540
}
4641
}
42+
43+
export default connect(
44+
({ github }) => ({ github }),
45+
dispatch => ({ actions: bindActionCreators(githubActions, dispatch) })
46+
)(GithubStargazers)

lib/components/pages/SuperSecretArea.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ const messages = defineMessages({
1010
}
1111
})
1212

13-
@secure('manage_account')
14-
export default class SuperSecretArea extends React.Component {
13+
class SuperSecretArea extends React.Component {
1514
render () {
1615
return (
1716
<div>
@@ -25,3 +24,5 @@ export default class SuperSecretArea extends React.Component {
2524
)
2625
}
2726
}
27+
28+
export default secure('manage_account')(SuperSecretArea)

package.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"test": "echo \"Error: no test specified\" && exit 1"
2626
},
2727
"dependencies": {
28-
"babel-runtime": "~5.8.29",
2928
"classnames": "~2.2.1",
3029
"history": "~1.13.1",
3130
"intl": "~1.0.1",
@@ -46,12 +45,19 @@
4645
"whatwg-fetch": "~0.10.1"
4746
},
4847
"devDependencies": {
49-
"babel": "^5.8.29",
50-
"babel-core": "^5.8.32",
51-
"babel-eslint": "^4.1.3",
52-
"babel-loader": "^5.3.2",
53-
"babel-plugin-react-intl": "^1.0.0-beta-5",
54-
"babel-plugin-react-transform": "^1.1.1",
48+
"babel-cli": "^6.3.17",
49+
"babel-core": "^6.3.21",
50+
"babel-eslint": "^5.0.0-beta6",
51+
"babel-loader": "^6.2.0",
52+
"babel-plugin-react-intl": "^2.0.0",
53+
"babel-plugin-react-transform": "^2.0.0-beta1",
54+
"babel-plugin-transform-decorators": "^6.3.13",
55+
"babel-plugin-transform-runtime": "^6.3.13",
56+
"babel-polyfill": "^6.3.14",
57+
"babel-preset-es2015": "^6.3.13",
58+
"babel-preset-react": "^6.3.13",
59+
"babel-preset-stage-0": "^6.3.13",
60+
"babel-runtime": "^6.3.19",
5561
"css-loader": "^0.23.0",
5662
"cssnext-loader": "^1.0.1",
5763
"eslint": "^1.10.3",

webpack.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
55
module.exports = {
66
devtool: 'cheap-module-eval-source-map',
77
entry: [
8+
'babel-polyfill',
89
'webpack-hot-middleware/client',
910
'./lib/index'
1011
],
@@ -32,7 +33,7 @@ module.exports = {
3233
module: {
3334
loaders: [
3435
{ test: /\.css$/, loader: 'style-loader!css-loader!cssnext-loader' },
35-
{ test: /\.js$/, loaders: ['babel'], include: path.join(__dirname, 'lib') }
36+
{ test: /\.js$/, loader: 'babel', include: path.join(__dirname, 'lib') }
3637
]
3738
},
3839
cssnext: {

webpack.config.production.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
55

66
module.exports = {
77
entry: {
8-
app: './lib/index.js'
8+
app: [ 'babel-polyfill', './lib/index.js' ]
99
},
1010
output: {
1111
filename: '[name].min.js',

0 commit comments

Comments
 (0)