-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
72 lines (61 loc) · 1.96 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
62
63
64
65
66
67
68
69
70
71
72
var tslint = require('gulp-tslint');
var exec = require('child_process').exec;
var jasmine = require('gulp-jasmine');
var gulp = require('gulp-help')(require('gulp'));
var path = require('path');
var inject = require('gulp-inject');
var gulpSequence = require('gulp-sequence');
var del = require('del');
var express = require('express');
require('dotbin');
gulp.task('clean', 'Cleans the generated js files from lib directory', function () {
return del([
'lib/**/*'
]);
});
gulp.task('tslint', 'Lints all TypeScript source files', function () {
return gulp.src('./src/**/*.ts')
.pipe(tslint())
.pipe(tslint.report('verbose'));
});
gulp.task('_build', 'INTERNAL TASK - Compiles all TypeScript source files', function (cb) {
exec('tsc --version', function (err, stdout, stderr) {
console.log('TypeScript ', stdout);
if (stderr) {
console.log(stderr);
}
});
return exec('tsc', function (err, stdout, stderr) {
console.log(stdout);
if (stderr) {
console.log(stderr);
}
cb(err);
});
});
gulp.task('build', 'Compiles all TypeScript source files and updates module references', function (callback) {
// gulpSequence('tslint', 'clean', '_build')(callback);
gulpSequence('clean', '_build')(callback); //TODO: tslint
});
gulp.task('test', 'Runs the Jasmine test specs', ['build'], function () {
return gulp.src('lib/test/**/*.spec.js')
.pipe(jasmine());
});
gulp.task('watch', 'Watches ts source files and runs build on change', function () {
gulp.watch('src/**/*.ts', ['build']);
});
gulp.task('server-local', [], function () {
var app = require('./lib/example/index');
var session = require('express-session');
express()
.use(session({
secret: 'example',
saveUninitialized: true,
resave: false,
cookie: {}
}))
.use('/api', app.middleware())
.listen(8000);
console.info('Local rest api server running on http://localhost:8000/');
});
gulp.task('default', 'Default task', ['test']);