forked from crossfilter/reductio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
80 lines (70 loc) · 1.99 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var streamify = require('gulp-streamify');
var shim = require('browserify-shim');
// var Gitdown = require('gitdown');
var bump = require('gulp-bump');
var karma = require('gulp-karma');
var testFiles = [
'node_modules/crossfilter2/crossfilter.min.js',
'node_modules/lodash/index.js',
'reductio.min.js',
'test/**/*.spec.js'
];
gulp.task('scripts', function () {
return browserify('./src/reductio.js', { standalone: 'reductio' })
.transform(shim)
.bundle()
.pipe(source('reductio.js'))
.pipe(gulp.dest('./'))
.pipe(rename('reductio.min.js'))
.pipe(streamify(uglify()))
.pipe(gulp.dest('./'));
});
gulp.task('docs', function () {
// Set up gitdown
// Gitdown.notice = function () { return ''; };
// var gitdown = Gitdown.read('docs/README.md');
// var config = gitdown.config;
// config.gitinfo.gitPath = './docs';
// gitdown.config = config;
// return gitdown
// .write('README.md');
});
gulp.task('bump', function(){
gulp.src(['./bower.json', './package.json'])
.pipe(bump({type:'minor'}))
.pipe(gulp.dest('./'));
});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch('./src/**/*.js', ['scripts']);
gulp.watch('./docs/*', ['docs']);
});
gulp.task('test', function () {
return gulp.src(testFiles)
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
}))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
throw err;
});
});
gulp.task('testWatch', function () {
return gulp.src(testFiles)
.pipe(karma({
configFile: 'karma.conf.js',
action: 'watch'
}))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
throw err;
});
});
gulp.task('default', ['scripts', 'docs', 'testWatch', 'watch']);
gulp.task('all', ['scripts', 'docs', 'test']);