-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
35 lines (27 loc) · 890 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
var gulp = require('gulp');
var server = require( 'gulp-develop-server' );
var PATHS = {
clientSrc: 'client/src/*.ts',
svrSrc: 'server/*.js'
};
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');
var tsResult = gulp
.src([PATHS.clientSrc, 'node_modules/angular2/typings/browser.d.ts'])
.pipe(typescript(tscConfig.compilerOptions));
return tsResult.js.pipe(gulp.dest('client/dist'));
});
gulp.task('server:restart', function (cb) {
server.restart();
});
gulp.task('play', ['ts2js'], function () {
gulp.watch(PATHS.clientSrc, ['ts2js']);
gulp.watch(PATHS.svrSrc, ['server:restart']);
server.listen( { path: './server/app.js' });
});
gulp.task('default', ['play']);