-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (54 loc) · 1.57 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
var gulp = require('gulp');
var ts = require('gulp-typescript');
var clean = require('gulp-clean');
var server = require('gulp-develop-server');
var mocha = require('gulp-mocha');
var serverTS = ["**/*.ts", "!node_modules/**", '!bin/**', ];
gulp.task('ts', ['clean'], function() {
return gulp
.src(serverTS, {base: './app/'})
.pipe(ts({ module: 'commonjs', noImplicitAny: true }))
.pipe(gulp.dest('./app'));
});
gulp.task('clean', function () {
return gulp
.src([
'!app/config/db/**',
'app/app.js',
'**/*.js',
'**/*.js.map',
'!node_modules/**',
'!gulpfile.js',
'!bin/**',
'!app/config/db/knex'
], {read: false})
.pipe(clean())
});
gulp.task('load:fixtures', function (cb) {
var load = require('./fixtures/load');
return load.loadData(cb);
});
gulp.task('server:start', ['ts'], function() {
server.listen({path: 'app/bin/www'}, function(error) {
console.log(error);
});
});
gulp.task('server:restart', ['ts'], function() {
server.restart();
});
gulp.task('default', ['server:start'], function() {
gulp.watch(serverTS, ['server:restart']);
});
gulp.task('test', ['ts', 'load:fixtures'], function() {
return gulp
.src('test/*.js', {read: false})
// wait for dev server to start properly :(
//.pipe(wait(600))
.pipe(mocha())
.once('error', function () {
process.exit(1);
})
.once('end', function () {
process.exit();
});
});