Skip to content

Commit 95aa1ed

Browse files
committed
Made build workflow better
1 parent 79e6438 commit 95aa1ed

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

gulpfile.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ const gulp = require('gulp')
33
const del = require('del')
44
const babel = require('gulp-babel')
55

6-
gulp.task('compile', () => {
7-
return gulp.src('src/**/*.js')
6+
const path = 'src/**/*.js'
7+
8+
gulp.task('default', () => {
9+
return gulp.src(path)
810
.pipe(babel())
911
.pipe(gulp.dest('dist'))
1012
})
1113

1214
gulp.task('clean', () => del(['dist']))
13-
gulp.task('default', ['compile'])

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"dist"
99
],
1010
"scripts": {
11-
"gulp": "gulp",
11+
"build": "gulp",
12+
"prepublish": "npm run build",
1213
"test": "xo && ava"
1314
},
1415
"babel": {
@@ -53,7 +54,11 @@
5354
"envs": [
5455
"browser",
5556
"jsx"
56-
]
57+
],
58+
"rules": {
59+
"react/require-default-props": 0,
60+
"react/no-unused-prop-types": 0
61+
}
5762
},
5863
"devDependencies": {
5964
"ava": "0.22.0",

src/frame.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
// Packages
12
import React from 'react'
23
import PropTypes from 'prop-types'
34

45
export default class Frame extends React.Component {
56
static propTypes = {
67
children: PropTypes.any,
78
component: PropTypes.any,
8-
duration: PropTypes.number, // eslint-disable-line react/no-unused-prop-types
9+
duration: PropTypes.number,
910
onRender: PropTypes.func
1011
};
1112

@@ -25,12 +26,14 @@ export default class Frame extends React.Component {
2526
render() {
2627
const {component} = this.props
2728
const props = {}
29+
2830
Object.keys(this.props).forEach(k => {
2931
if (Frame.propTypes[k]) {
3032
return
3133
}
3234
props[k] = this.props[k]
3335
})
36+
3437
return React.createElement(component, props, this.props.children)
3538
}
3639
}

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
// Utilities
12
export {default as Keyframes} from './keyframes'
23
export {default as Frame} from './frame'

src/keyframes.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
// Packages
12
import React from 'react'
23
import PropTypes from 'prop-types'
4+
5+
// Utilities
36
import Frame from './frame'
47

58
const noop = () => {}
@@ -10,9 +13,9 @@ export default class Keyframes extends React.Component {
1013
component: PropTypes.any, // eslint-disable-line react/no-unused-prop-types
1114
delay: PropTypes.number,
1215
loop: PropTypes.oneOfType([
13-
React.PropTypes.string,
14-
React.PropTypes.number,
15-
React.PropTypes.bool
16+
PropTypes.string,
17+
PropTypes.number,
18+
PropTypes.bool
1619
]),
1720
onStart: PropTypes.func,
1821
onEnd: PropTypes.func
@@ -75,7 +78,7 @@ export default class Keyframes extends React.Component {
7578

7679
const props = {}
7780
Object.keys(this.props).forEach(k => {
78-
// don't pass props which exist only on Keyframes
81+
// Don't pass props which exist only on Keyframes
7982
if (Keyframes.propTypes[k] && !Frame.propTypes[k]) {
8083
return
8184
}

0 commit comments

Comments
 (0)