This repository has been archived by the owner on Apr 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgulpfile.js
70 lines (60 loc) · 1.73 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
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
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 karma = require('gulp-karma');
var Server = require('karma').Server;
var testFiles = [
'crossfilter-async.js',
'test/*.spec.js'
];
gulp.task('scripts', function () {
return browserify('./src/crossfilter-async.js', { standalone: 'crossfilterAsync' })
.transform(shim)
.bundle()
.pipe(source('crossfilter-async.js'))
.pipe(gulp.dest('./'))
.pipe(rename('crossfilter-async.min.js'))
.pipe(streamify(uglify()))
.pipe(gulp.dest('./'));
});
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', ['jshint', 'jscs', 'scripts']);
});
gulp.task('test', function (done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
gulp.task('testWatch', function (done) {
new Server({
configFile: __dirname + '/karma.conf.js'
}, done).start();
});
//Lint JavaScript
gulp.task('jshint', function () {
return gulp.src('src/*')
.pipe($.jshint.extract()) // Extract JS from .html files
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'));
});
//JavaScript Code Style
gulp.task('jscs', function () {
return gulp.src([
'src/*.js'
])
.pipe($.jscs());
});
gulp.task('default', ['scripts', 'testWatch', 'watch']);
gulp.task('all', ['jshint', 'jscs', 'scripts', 'test']);