-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (50 loc) · 1.46 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
var gulp = require("gulp");
var ts = require("gulp-typescript");
var tslint = require("gulp-tslint");
var watch = require("gulp-watch");
var server = require('gulp-develop-server');
var cache = require('gulp-cached');
var clean = require('gulp-clean');
var apidoc = require('gulp-apidoc');
var tsProject = ts.createProject("tsconfig.json");
var sourceFilePath = "src/**/*";
var distFolder = "out";
gulp.task("compile", ['tslint'], function () {
// Copy js files to dist
gulp.src(sourceFilePath + ".{js,html,css}")
.pipe(cache('copying'))
.pipe(gulp.dest(distFolder));
// Compile typescript files and copy to dist
return tsProject.src()
.pipe(cache('compiling'))
.pipe(tsProject())
.js.pipe(gulp.dest(distFolder))
});
gulp.task("tslint", function() {
tsProject.src()
.pipe(cache('linting'))
.pipe(tslint({
configuration: "tslint.json"
}))
.pipe(tslint.report())
});
gulp.task("clean", function() {
return gulp.src(distFolder, {read: false})
.pipe(clean());
});
gulp.task("watch", function() {
gulp.watch(sourceFilePath, ['tslint', 'compile']);
});
gulp.task('server:start', function() {
server.listen( { path: './bin/start.js' } );
});
gulp.task('server:livereload', function() {
gulp.watch(sourceFilePath, ['tslint', 'compile', server.restart]);
});
gulp.task('apidoc', function(done) {
apidoc({
src: "src/routes",
dest: "doc/"
}, done);
});
gulp.task('start', ['compile', 'server:start', 'server:livereload']);