-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
54 lines (45 loc) · 1.35 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
'use strict';
const gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
babel = require('gulp-babel'),
mocha = require('gulp-mocha'),
del = require('del'),
plumber = require('gulp-plumber'),
util = require('gulp-util'),
eslint = require('gulp-eslint'),
babelRegister = require('babel-core/register');
let paths = {
scripts: ['src/**/*.es6'],
tests: ['test/**/*.js']
};
gulp.task('clean', () => {
return del(['build']);
});
gulp.task('lint', function () {
gulp.src(paths.scripts)
.pipe(eslint())
.pipe(eslint.failOnError());
});
gulp.task('test', function () {
return gulp.src(paths.tests, { read: false })
.pipe(mocha({
require: 'babel-register',
reporter: 'list'
}))
.on('error', util.log);
});
gulp.task('build', () => {
gulp.src(paths.scripts)
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(babel({
presets: ['babel-preset-es2015']
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('build'));
});
gulp.task('watch', () => {
gulp.watch(paths.scripts, ['build']);
});
gulp.task('default', ['clean', 'lint', 'test', 'build']);
gulp.task('prepublish', ['clean', 'test', 'lint', 'build']);