-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
76 lines (64 loc) · 1.81 KB
/
gulpfile.js
File metadata and controls
76 lines (64 loc) · 1.81 KB
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
73
74
75
76
'use strict';
/* Utils
https://github.com/ivogabe/gulp-typescript
*/
var gulp = require('gulp'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
nodemon = require('gulp-nodemon'),
ts = require('gulp-typescript'),
tslint = require('gulp-tslint'),
sourcemaps = require('gulp-sourcemaps');
var tsProject = ts.createProject('tsconfig.json');
var frontSrc = 'src/front/**/*.ts',
serverSrc = 'src/server/**/*.ts';
gulp.task('clean', function () {
return gulp.src('dist', {read: false})
.pipe(clean());
});
gulp.task('nodemon', ['script-nodejs'], function () {
return nodemon({
script: __dirname + '/dist/app.js',
ext: 'ts html',
env: {
'NODE_ENV': 'development',
'configServerPath': __dirname + '/dist/config/config.js',
'loggerPath': 'server.log'
},
tasks: ['script-nodejs']
});
});
gulp.task('nodemon-oauth', function () {
return nodemon({
script: __dirname + '/mock/oauth.js',
ext: 'nope'
});
});
gulp.task('script-nodejs', ['clean'], function () {
var tsResult = tsProject.src()
.pipe(sourcemaps.init())
.pipe(ts(tsProject));
return tsResult
.js
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'));
});
gulp.task('script-front', function () {
return gulp.src([frontSrc])
.pipe(sourcemaps.init()) // This means sourcemaps will be generated
.pipe(ts())
.js
.pipe(concat('app.js'))
.pipe(sourcemaps.write()) // Now the sourcemaps are added to the .js file
.pipe(gulp.dest('dist/public'));
});
gulp.task('tslint', function () {
return gulp.src([serverSrc, frontSrc])
.pipe(tslint())
.pipe(tslint.report('verbose'));
});
gulp.task('watch', function () {
return gulp.watch(['./src/server/**/*.ts'], ['script-nodejs']);
});
gulp.task('serve', ['nodemon']);
gulp.task('oauth', ['nodemon-oauth']);