-
Notifications
You must be signed in to change notification settings - Fork 23
/
gulpfile.js
45 lines (38 loc) · 1 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
'use strict';
let gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
babel = require('gulp-babel'),
eslint = require('gulp-eslint'),
mocha = require('gulp-mocha');
require('babel/register')({
experimental: true
});
gulp.task('lint', function () {
return gulp
.src(['./src/**/*.js', './src/tests/**/*.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
gulp.task('bundle', ['lint'], function () {
return gulp
.src('src/main.js')
.pipe(sourcemaps.init())
.pipe(babel({
experimental: true,
optional: ['runtime']
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/'));
});
gulp.task('test', ['bundle'], function () {
return gulp
.src('./tests/*.js', {
read: false
})
.pipe(mocha());
});
gulp.task('default', ['test']);
gulp.task('watch', function () {
gulp.watch(['src/**/*', 'tests/**/*'], ['default']);
});