forked from pierremtb/easy-fit
-
Notifications
You must be signed in to change notification settings - Fork 34
/
gulpfile.babel.js
66 lines (56 loc) · 1.4 KB
/
gulpfile.babel.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
63
64
65
66
import gulp from 'gulp';
import babel from 'gulp-babel';
import mocha from 'gulp-mocha';
import jshint from 'gulp-jshint';
import del from 'del';
import runSequence from 'run-sequence';
var config = {
paths: {
js: {
src: 'src/**/*.js',
dist: 'dist/',
},
test: {
src: 'test/**/*.js',
dist: 'test-dist/',
run: 'test-dist/**/*.js',
}
}
};
gulp.task('clean', () =>
del(config.paths.js.dist)
);
gulp.task('babel', ['babel-src', 'babel-test']);
gulp.task('babel-src', ['lint-src'], () =>
gulp.src(config.paths.js.src)
.pipe(babel())
.pipe(gulp.dest(config.paths.js.dist))
);
gulp.task('babel-test', ['lint-test'], () =>
gulp.src(config.paths.test.src)
.pipe(babel())
.pipe(gulp.dest(config.paths.test.dist))
);
gulp.task('lint-src', () =>
gulp.src(config.paths.js.src)
.pipe(jshint())
.pipe(jshint.reporter('default'))
);
gulp.task('lint-test', () =>
gulp.src(config.paths.test.src)
.pipe(jshint())
.pipe(jshint.reporter('default'))
);
gulp.task('watch', () => {
gulp.watch(config.paths.js.src, ['babel-src', 'test']);
gulp.watch(config.paths.test.src, ['babel-test', 'test']);
});
gulp.task('test', ['babel'], () =>
gulp.src([config.paths.test.run])
.pipe(mocha({ reporter: 'spec' }))
.on('error', err => console.log(err.stack))
);
// Default Task
gulp.task('default', () =>
runSequence('clean', ['babel', 'test'])
);