This repository has been archived by the owner on Feb 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgulpfile.js
65 lines (53 loc) · 1.52 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
'use strict';
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var coveralls = require('gulp-coveralls');
var tsc = require('gulp-typescript');
var karma = require('karma').server;
var del = require('del');
var paths = {
app: 'app/',
dist: 'dist/',
amd: 'dist/amd',
commonjs: 'dist/commonjs',
appSourceDest: 'app/src',
appTestDest: 'app/test',
libSource: ['src/*.ts'],
libTest: ['test/*.ts']
};
var shouldExit = true;
gulp.task('clean', function(cb) {
del([paths.dist, paths.app], cb);
});
gulp.task('build-source', ['clean'], function() {
var tsResult = gulp.src(paths.libSource)
.pipe(tsc({
module: 'amd',
target: 'ES5',
declarationFiles: true
}));
tsResult.dts.pipe(gulp.dest(paths.amd));
tsResult.js.pipe(gulp.dest(paths.amd))
return tsResult.js.pipe(gulp.dest(paths.appSourceDest));
});
gulp.task('build-test', ['clean', 'build-source'], function() {
return gulp.src(paths.libTest)
.pipe(tsc({
module: 'amd',
target: 'ES5',
declarationFiles: false
}))
.pipe(gulp.dest(paths.appTestDest));
});
gulp.task('build', ['build-source', 'build-test']);
gulp.task('test', ['build'], function (done) {
karma.start({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done);
});
gulp.task('covertest', ['build','test'], function() {
return gulp.src('coverage/**/lcov.info')
.pipe(coveralls());
});
gulp.task('default', ['build', 'test']);