-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGulpfile.js
42 lines (37 loc) · 1.03 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
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var mocha = require('gulp-mocha');
var babel = require('gulp-babel');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var del = require('del');
gulp.task('lint', function() {
gulp.src(['src/**/*.js', 'test/**/*.js'])
.pipe(jshint({
esnext: true
}))
.pipe(jshint.reporter(stylish))
.pipe(jshint.reporter('fail'));
});
gulp.task('test', function() {
require('babel/register');
gulp.src(['test/**/*Test.js'])
.pipe(mocha({
reporter: 'spec'
}));
});
gulp.task('clean', function() {
del('dist');
});
gulp.task('dist', ['lint', 'test', 'clean'], function() {
gulp.src(['src/chusha.js'])
.pipe(babel({
modules: 'umd'
}))
.pipe(gulp.dest('dist'))
.pipe(uglify())
.pipe(rename('chusha.min.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('default', ['lint', 'test', 'dist']);