forked from strongloop/angular-live-set
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
65 lines (58 loc) · 1.61 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
var gulp = require('gulp');
var del = require('del');
var concat = require('gulp-concat');
var karma = require('gulp-karma');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var DEST = 'dist';
var SRC_FILES = ['modules/**/*.js', '!modules/**/test/*.js', '!modules/**/demo/*.js'];
var LB_PORT = 4558;
var testServer;
// clean
gulp.task('clean', function() {
del('dist');
});
// build
gulp.task('build', ['clean', 'lint', 'compress'], function() {
return gulp.src(SRC_FILES)
.pipe(concat('live-set.js'))
.pipe(gulp.dest(DEST));
});
gulp.task('compress', function() {
return gulp.src(SRC_FILES)
.pipe(uglify())
.pipe(concat('live-set.min.js'))
.pipe(gulp.dest(DEST));
});
// test
gulp.task('test', ['lint', 'test-server'], function() {
return gulp.src([
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'modules/*/*.js',
'modules/*/test/*.test.js'
])
.pipe(karma({
configFile: 'test/karma.conf.js',
action: 'run'
}))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
throw err;
})
.on('end', function() {
testServer.close();
process.nextTick(function() {
// this should not be required...
process.exit();
});
});
});
gulp.task('test-server', function(done) {
testServer = require('./test/fixtures/event-source')(LB_PORT, done);
});
gulp.task('lint', function() {
return gulp.src(['modules/**/*.js', '!modules/change-stream/stream.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});