-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
48 lines (38 loc) · 1.2 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
var gulp = require('gulp');
var babel = require('gulp-babel');
var concat = require('gulp-concat');
var livereload = require('gulp-livereload');
var gutil = require('gulp-util');
var uglify = require('gulp-uglify');
var mocha = require('gulp-mocha');
var files = ['lib/**/*.js'];
var tests = ['test/**/*.js'];
var alljs = files.concat(tests);
gulp.task('default', function () {
return gulp.src(files)
.pipe(mocha({reporter: 'nyan'}))
.pipe(babel({presets: ['es2015']}))
.pipe(concat('lib-crypto.js'))
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
gulp.task('watch', function() {
livereload.listen();
gulp.watch(files,['default']).on('change', function(file) {
livereload.changed(file.path);
gutil.log(gutil.colors.yellow('JS changed' + ' (' + file.path + ')'));
});
});
var testmocha = function() {
return gulp.src(tests).pipe(new mocha({
reporter: 'nyan'
}));
};
gulp.task('test', testmocha);
gulp.task('watch:test', function() {
livereload.listen();
gulp.watch(files,['test']).on('change', function(file) {
livereload.changed(file.path);
gutil.log(gutil.colors.yellow('JS changed' + ' (' + file.path + ')'));
});
});