-
Notifications
You must be signed in to change notification settings - Fork 10
/
gulpfile.js
69 lines (60 loc) · 1.75 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
var gulp = require('gulp');
var util = require('gulp-util');
var tsc = require('gulp-typescript');
var mocha = require('gulp-mocha');
var runSequence = require('run-sequence');
var Server = require('karma').Server;
function handleError(err) {
console.log(err.toString());
this.emit('end');
}
gulp.task('compile-ts', ['compile-server', 'compile-client', 'compile-protractor']);
gulp.task('compile-server', function () {
return gulp.src(['./**/*.ts', '!./node_modules/**', '!./typings/**', '!./public/**/*.ts', '!./test-ui/*.ts'])
.pipe(tsc({
module: "commonjs",
target: "ES5"
}))
.on('error', util.log)
.pipe(gulp.dest('./'));
});
gulp.task('compile-client', function () {
return gulp.src(['./public/**/*.ts'])
.pipe(tsc({
module: "amd",
target: "ES5"
}))
.on('error', util.log)
.pipe(gulp.dest('./public'));
});
gulp.task('compile-protractor', function () {
return gulp.src(['./test-ui/*.ts'])
.pipe(tsc({
module: "commonjs",
target: "ES5"
}))
.on('error', util.log)
.pipe(gulp.dest('./test-ui'));
});
gulp.task('test', function () {
return gulp.src('./test/*.js', { read: false })
// gulp-mocha needs filepaths so you can't have any plugins before it
.pipe(mocha({ reporter: 'spec' }))
.on('error', handleError);
});
gulp.task('karma', function (done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, function() {
done();
}).start();
});
gulp.task('watch', function () {
gulp.watch(['./**/*.ts'], function () {
runSequence('compile-ts', 'test', 'karma');
});
});
gulp.task('default', function () {
runSequence('compile-ts', 'test', 'karma', 'watch');
});