-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
49 lines (43 loc) · 1.33 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
var browserify = require('browserify');
var exec = require('child_process').exec;
var es6ify = require('es6ify');
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var traceur = require('gulp-traceur');
var uglify = require('gulp-uglify');
var rimraf = require('rimraf');
var buffer = require('vinyl-buffer');
var source = require('vinyl-source-stream');
gulp.task('clean', function(callback) {
rimraf('./lib', callback);
});
gulp.task('build', ['clean'], function() {
return gulp.src('src/**/*.js')
.pipe(traceur({modules: 'commonjs'}))
.pipe(gulp.dest('./lib'));
});
gulp.task('lint', function() {
return gulp.src(['src/**/*.js', 'test/**/*.js', 'gulpfile.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('test', function(callback) {
return exec('./node_modules/.bin/mocha --compilers js:mocha-traceur',
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
callback(err);
});
});
gulp.task('browserify', ['build'], function() {
return browserify('./browserified/exports.js')
.transform(es6ify)
.bundle()
.pipe(source('kulku.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest('./browserified/'));
});
gulp.task('default', function () {
gulp.start('browserify');
});