-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.babel.js
47 lines (39 loc) · 1.29 KB
/
gulpfile.babel.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
import gulp from 'gulp';
import mocha from 'gulp-mocha';
import sourceMaps from 'gulp-sourcemaps';
import gutil from 'gulp-util';
import babelify from 'babelify';
import babel from 'gulp-babel';
import browserify from 'browserify';
import source from 'vinyl-source-stream';
import streamify from 'gulp-streamify';
import rename from 'gulp-rename';
import uglify from 'gulp-uglify';
import jshint from 'gulp-jshint';
gulp.task('test', function(done){
return gulp.src(['*_test.js'], {read: false})
.pipe(mocha({reporter: 'spec'}));
});
gulp.task('dev', ['build'], () => {
gulp.watch(['**/*.js', '!app.js', '!**/*_test.js', '!gulpfile.js'], ['build']);
});
gulp.task('build', () => {
let bundler = browserify({ debug: true }),
b;
bundler.transform(babelify);
bundler.add('./index.js');
b = bundler.bundle()
.on('error', gutil.log)
.pipe(source('./index.js'))
.pipe(gulp.dest('../'))
.pipe(streamify(uglify()))
.pipe(rename('bernstein.min.js'))
.pipe(gulp.dest('./dist'));
gulp.src('./index.js')
.pipe(babel())
.pipe(rename('bernstein.cjs.js'))
.pipe(gulp.dest('./dist'));
return gulp.src('./index.js')
.pipe(rename('bernstein.es6.js'))
.pipe(gulp.dest('./dist'));
});