-
Notifications
You must be signed in to change notification settings - Fork 14
/
gulpfile.js
44 lines (37 loc) · 1.21 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
var gulp = require('gulp'),
//uglify = require('gulp-uglify'),
notify = require('gulp-notify'),
babel = require('gulp-babel'),
browserify = require('browserify'),
buffer = require('gulp-buffer'),
source = require('vinyl-source-stream'),
babelify = require('babelify'),
mocha = require('gulp-mocha')
gulp.task( 'js', function() {
browserify({ debug:true, standalone:'genish' })
.require( './js/index.js', { entry: true } )
.transform( babelify, { presets:['es2015'] })
.bundle()
.pipe( source('gen.lib.js') )
.pipe( gulp.dest('./dist') )
//.pipe( uglify() )
// notify() doesn't work in linux?
//.pipe(
// notify({
// message:'Build has been completed',
// onLast:true
// })
//)
// transpile (but don't browserify) for use with node.js tests
return gulp.src( './js/**.js' )
.pipe( babel({ presets:['es2015'] }) )
.pipe( gulp.dest('./dist' ) )
})
gulp.task( 'test', ['js'], ()=> {
return gulp.src('test/*.js', {read:false})
.pipe( mocha({ reporter:'nyan' }) ) // spec, min, nyan, list
})
gulp.task( 'watch', function() {
gulp.watch( './js/**.js', ['test'] )
})
gulp.task( 'default', ['js','test'] )