-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.babel.js
59 lines (52 loc) · 1.32 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
/**
* Gulp task definition
* @author Satoshi Haga
* @date 2015/09/30
*/
const gulp = require('gulp');
const $ = require('gulp-load-plugins')();
const runSequence = require('run-sequence');
const config = {
js: {
src: 'src/**/*.js',
test: 'test/**/*.test.js',
dest: './'
},
uglify: {
src: './excelmerge.js',
src_lib: 'lib/*.js',
dest: './',
dest_lib: 'lib'
}
};
gulp.task('compile', () => {
return gulp.src(config.js.src)
.pipe($.babel())
.pipe(gulp.dest(config.js.dest));
});
gulp.task('compress', ['compress-excelmerge', 'compress-lib']);
gulp.task('compress-excelmerge', () => {
return gulp.src(config.uglify.src)
.pipe($.uglify())
.pipe(gulp.dest(config.uglify.dest));
});
gulp.task('compress-lib', () => {
return gulp.src(config.uglify.src_lib)
.pipe($.uglify())
.pipe(gulp.dest(config.uglify.dest_lib));
});
gulp.task('lint', () => {
return gulp.src(config.js.src)
.pipe($.eslint({useEslintrc: true}))
.pipe($.eslint.format())
.pipe($.eslint.failAfterError());
});
gulp.task('mocha', () => {
return gulp.src(config.js.test)
.pipe($.mocha());
});
gulp.task('default', (cb) => {
runSequence(
'lint', 'compile', 'compress', 'mocha', cb
)
});