-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (41 loc) · 1.09 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
const gulp = require('gulp');
const ts = require('gulp-typescript');
const del = require('del');
const gulpCopy = require('gulp-copy');
const nodemon = require('gulp-nodemon');
const tsProject = ts.createProject('tsconfig.json');
gulp.task('compile', () => {
return tsResult = tsProject.src().pipe(tsProject()).js.pipe(gulp.dest('.'));
});
gulp.task('clean', function(cb) {
return del('dist', cb);
})
gulp.task('copy-static', ['clean'], function() {
var source = [
'views/**/*',
'public/**/*',
'models/**/*'
]
return gulp.src(source)
.pipe(gulpCopy('dist'));
});
gulp.task('watch', ['compile'], () => {
var stream = nodemon({
script: 'bin/www'
, ext: 'ts'
, watch: '.'
, tasks: ['compile']
});
return stream;
});
gulp.task('run', () => {
var stream = nodemon({
script: './dist/bin/www.js'
});
return stream;
});
gulp.task('build', ['copy-static'], () => {
return tsProject.src().pipe(tsProject())
.js.pipe(gulp.dest('dist'));
});
gulp.task('default', ['watch']);