-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
79 lines (61 loc) · 1.66 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
'use strict';
var gulp = require('gulp');
var concat = require('gulp-concat');
var typescript = require('gulp-typescript');
var sourcemaps = require('gulp-sourcemaps');
var karma = require('karma');
var path = require('path');
var runSequence = require('run-sequence');
var tsProject = {
sortOutput: true
};
var tsSources = [
'src/*.ts'
];
gulp.task('typescript', function () {
var tsResult = gulp.src(tsSources)
.pipe(sourcemaps.init())
.pipe(typescript(tsProject));
return tsResult
.pipe(concat('vorton.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./lib/'));
});
var testProject = {
sortOutput: true
};
var testSources = [
'spec/**/*.ts'
];
gulp.task('typescript-tests', function () {
var tsResult = gulp.src(testSources)
.pipe(sourcemaps.init())
.pipe(typescript(testProject))
return tsResult
.pipe(sourcemaps.write())
.pipe(gulp.dest('./spec/.dist/'))
});
gulp.task('karmaSingleRun', function (done) {
var server = new karma.Server({
configFile: path.join(__dirname, './karma.conf.js'),
logLevel: 'ERROR',
singleRun: true
}, done);
server.start();
});
gulp.task('karma', function (done) {
var server = new karma.Server({
configFile: path.join(__dirname, './karma.conf.js')
}, done);
server.start();
});
gulp.task('watch', function () {
gulp.watch(tsSources, ['typescript']);
gulp.watch(testSources, ['typescript-tests']);
});
gulp.task('test', function (callback) {
runSequence(['typescript', 'typescript-tests'], 'karmaSingleRun');
});
gulp.task('default', function (callback) {
runSequence(['typescript', 'typescript-tests'], ['karma', 'watch']);
});