-
Notifications
You must be signed in to change notification settings - Fork 10
/
gulpfile.js
62 lines (51 loc) · 1.17 KB
/
gulpfile.js
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
62
'use strict';
var gulp = require('gulp');
var runSequence = require('run-sequence');
var plugins = require('gulp-load-plugins')({scope: ['dependencies']});
var del = require('del');
var browserSync = require('browser-sync').create();
/**
* Jest cli requires --harmony flags for < node 0.12
*/
require('harmonize')();
/*
* Helper tasks
*/
gulp.task('clean', function (cb) {
del('components', function () {
cb();
});
});
gulp.task('build', function () {
return gulp.src(['app.js', 'scripts/*.js'])
.pipe(plugins.react())
.pipe(gulp.dest('components'));
});
gulp.task('watch-source', ['build'], browserSync.reload);
gulp.task('serve', function () {
browserSync.init({
server: {
baseDir: './'
}
});
gulp.watch(['app.js', 'scripts/*.js', '*.html'], ['watch-source']);
});
gulp.task('jest', plugins.shell.task('npm test', {
// So our task doesn't error out when a test fails
ignoreErrors: true
}));
/*
* Main tasks
*/
gulp.task('develop', function (cb) {
runSequence(
'clean',
'build',
'serve',
cb
);
});
gulp.task('test', function () {
runSequence('jest');
gulp.watch(['scripts/*.js','__tests__/*.js'], ['jest'])
});