-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
32 lines (25 loc) · 889 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
const gulp = require('gulp');
const gls = require('gulp-live-server');
const spawn = require('child_process').spawn;
const serverFileName = '.build/api/index.js';
const pipeOptions = {stdio: 'inherit'}
gulp.task('serve', function() {
const server = gls.new(serverFileName);
server.start();
return gulp.watch(['**/**/**.{ts,js}'], {delay: 1200}, function(done) {
console.log('restarting server...')
spawn('npm', ['run', 'build'], pipeOptions, function (err, stdout, stderr) {
server.start.bind(server)();
done();
});
});
});
gulp.task('watch-test', function() {
spawn('npm', ['test'], pipeOptions);
return gulp.watch(['**/**/**.{ts,js}'], {delay: 1200}, function(done) {
console.log('re-running tests')
spawn('npm', ['test'], pipeOptions, () => {
done();
});
});
});