-
Notifications
You must be signed in to change notification settings - Fork 25
/
gulpfile.js
42 lines (33 loc) · 1010 Bytes
/
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
var gulp = require('gulp');
var PATHS = {
src: 'src/**/*.ts'
};
gulp.task('clean', function (done) {
var del = require('del');
del(['dist'], done);
});
gulp.task('ts2js', function () {
var typescript = require('gulp-typescript');
var tsResult = gulp.src(PATHS.src)
.pipe(typescript({
noImplicitAny: false,
module: 'system',
target: 'ES5',
moduleResolution: 'node',
emitDecoratorMetadata: true,
experimentalDecorators: true
}));
return tsResult.js.pipe(gulp.dest('dist'));
});
gulp.task('play', ['ts2js'], function () {
var http = require('http');
var connect = require('connect');
var serveStatic = require('serve-static');
var open = require('open');
var port = 9000, app;
gulp.watch(PATHS.src, ['ts2js']);
app = connect().use(serveStatic(__dirname));
http.createServer(app).listen(port, function () {
open('http://localhost:' + port);
});
});