-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
71 lines (61 loc) · 1.68 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
63
64
65
66
67
68
69
70
71
var gulp = require('gulp');
var babel = require('gulp-babel');
var src_dir = './src/*.js'
gulp.task('default', ['compile', 'compile:watch'])
gulp.task('test', ['mocha:env', 'mocha', 'mocha:watch'])
gulp.task('lint', ['eslint', 'eslint:watch'])
/** */
gulp.task('compile', function () {
gulp.src(src_dir)
.pipe(babel())
.pipe(gulp.dest('dist'));
});
gulp.task('compile:watch', function(){
gulp.watch(src_dir, ['compile']);
});
/** */
gulp.task('minify', function() {
var uglify= require('gulp-uglify');
gulp.src(['./dist/**/*.js'])
.pipe(uglify())
.pipe(gulp.dest('./build'))
});
/** */
gulp.task('mocha', function() {
var mocha = require('gulp-mocha');
var gutil = require('gulp-util');
gulp.src(['test/*.js'], {read: false})
.pipe(mocha({reporter: 'list', require: ["babel-core/register"]}))
.on('error', gutil.log);
});
gulp.task('mocha:watch', function() {
gulp.watch(['src/**/*.js', 'test/**/*.js'], ['mocha']);
});
gulp.task('mocha:env', function () {
var env = require('gulp-env');
env({vars: {BABEL_ENV: "test"}})
});
/** */
gulp.task('eslint', function() {
var eslint = require('gulp-eslint');
gulp.src(["src/**/*.js", "test/**/*.js"])
.pipe(eslint({useEslintrc: true}))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('eslint:watch', function() {
gulp.watch(['src/**/*.js', "test/**/*.js"], ['lint']);
});
/** */
//gulp.task('typecheck', function() {
// var flow = require("gulp-flowtype");
// return gulp.src('./src/*.js')
// .pipe(flow({
// all: false,
// weak: false,
// declarations: './lib',
// killFlow: true,
// beep: true,
// abort: false
// }))
//});