This repository was archived by the owner on Jan 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
61 lines (53 loc) · 1.3 KB
/
gulpfile.js
File metadata and controls
61 lines (53 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
var gulp = require('gulp');
var babel = require('gulp-babel');
var eslint = require('gulp-eslint');
var notify = require('gulp-notify');
var changed = require('gulp-changed');
var clean = require('gulp-clean');
var todo = require('gulp-todo');
//TODO Re-add flowcheck
gulp.task('todo', function() {
gulp.src('src/**/*.js')
.pipe(todo())
.pipe(gulp.dest('./'));
});
gulp.task('clean', function() {
return gulp.src('lib', {
read: false
})
.pipe(clean({
force: true
}));
});
gulp.task('hint', function() {
return gulp.src(['src/**/*.js'], {
write: false
})
.pipe(eslint({
configFile: '.eslintrc',
useEslintrc: true
}))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('build-dev', ['hint'], function() {
return gulp.src(['src/**/*.js'])
.pipe(changed('lib'))
.pipe(babel({
sourceMaps: "inline"
}))
.pipe(gulp.dest('lib'));
});
gulp.task('build-prod', ['hint', 'clean', 'todo'], function() {
return gulp.src(['src/**/*.js'])
.pipe(babel({
sourceMaps: false,
compact: true
}))
.pipe(gulp.dest('lib'))
.on('error', notify.onError('<%= error.message %>'));
});
gulp.task('watch', function() {
return gulp.watch(['src/**/*.js'], ['build-dev']);
});
gulp.task('default', ['build-dev']);