-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathgulpfile.js
51 lines (45 loc) · 1.37 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
50
51
const gulp = require('gulp'),
babel = require('gulp-babel'),
browserify = require('browserify'),
uglify = require('gulp-uglify'),
sourcemaps = require('gulp-sourcemaps'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
runSequence = require('run-sequence');
gulp.task('babel-zango', () => {
return gulp.src('./src/**/*.js')
.pipe(babel({ presets: ['es2015'] }))
.pipe(gulp.dest('./build/src'));
});
gulp.task('browserify-zango', () => {
return browserify('./build/src/index.js', {
standalone: 'zango'
})
.bundle()
.pipe(source('zangodb.min.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(uglify())
.pipe(sourcemaps.write('/'))
.pipe(gulp.dest('./dist'));
});
gulp.task('babel-test', () => {
return gulp.src('./test/**/*.js')
.pipe(babel({ presets: ['es2015'] }))
.pipe(gulp.dest('./build/test'));
});
gulp.task('browserify-test', () => {
return browserify('./build/test/index.js')
.bundle()
.pipe(source('zangodb-test-suite.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('build', (cb) => {
runSequence(...[
'babel-zango',
'browserify-zango',
'babel-test',
'browserify-test'
], cb);
});
gulp.task('default', ['build']);