This repository has been archived by the owner on Feb 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
70 lines (55 loc) · 1.6 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 livereload = require('gulp-livereload');
var PATHS = {
src: 'src/**/*.ts',
demo: 'demo/**/*.ts'
};
gulp.task('clean', function (done) {
var del = require('del');
del(['dist'], done);
});
gulp.task('ts2js', function () {
var typescript = require('gulp-typescript');
var tscConfig = require('./tsconfig.json');
gulp.src([PATHS.src, './typings/index.d.ts', PATHS.demo])
.pipe(typescript(tscConfig.compilerOptions))
.js.pipe(gulp.dest('src'))
.pipe(livereload());
});
gulp.task('test', function (done) {
var karmaServer = require('karma').Server;
new karmaServer({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
gulp.task('tdd', function (done) {
var karmaServer = require('karma').Server;
new karmaServer({
configFile: __dirname + '/karma.conf.js'
}, done).start();
});
gulp.task("tslint", function() {
var tslint = require("gulp-tslint");
gulp.src(PATHS.src)
.pipe(tslint())
.pipe(tslint.report("verbose"));
gulp.src(PATHS.demo)
.pipe(tslint())
.pipe(tslint.report("verbose"));
});
gulp.task('play', ['ts2js'], function () {
var http = require('http');
var connect = require('connect');
var serveStatic = require('serve-static');
var open = require('open');
var port = 8000, app;
livereload.listen({quiet: true});
gulp.watch(PATHS.src, ['ts2js']);
gulp.watch(PATHS.demo, ['ts2js']);
app = connect().use(serveStatic(__dirname));
http.createServer(app).listen(port, function () {
open('http://localhost:' + port + '/demo');
});
});
gulp.task('default', ['play']);