-
Notifications
You must be signed in to change notification settings - Fork 9
/
gulpfile.js
94 lines (81 loc) · 3.07 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
"use strict";
//******************************************************************************
//* DEPENDENCIES
//******************************************************************************
var gulp = require("gulp"),
browserify = require("browserify"),
tsify = require("tsify"),
source = require("vinyl-source-stream"),
buffer = require("vinyl-buffer"),
tslint = require("gulp-tslint"),
tsc = require("gulp-typescript"),
sourcemaps = require("gulp-sourcemaps"),
uglify = require("gulp-uglify"),
runSequence = require("run-sequence"),
browserSync = require('browser-sync').create(),
KarmaServer = require('karma').Server,
run = require('gulp-run');
//******************************************************************************
//* LINT
//******************************************************************************
gulp.task("lint", function() {
var config = { formatter: "verbose", emitError: (process.env.CI) ? true : false };
return gulp.src([
"src/**/**.ts",
"src/**/**.tsx",
"test/**/**.test.ts"
])
.pipe(tslint(config))
.pipe(tslint.report());
});
//******************************************************************************
//* BUILD TEST
//******************************************************************************
var tsTestProject = tsc.createProject("tsconfig.json");
gulp.task("build-test", function() {
return gulp.src([
"src/**/**.ts",
"src/**/**.tsx",
"test/**/**.test.ts",
"typings/main.d.ts/",
"src/interfaces/interfaces.d.ts"],
{ base: "." }
)
.pipe(tsTestProject())
.on("error", function (err) {
process.exit(1);
})
.js
.pipe(gulp.dest("."));
});
//******************************************************************************
//* TEST
//******************************************************************************
gulp.task("test", function(done) {
new KarmaServer({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
//******************************************************************************
//* BUILD DEV
//******************************************************************************
gulp.task("build", function() {
return run('node build.js').exec();
});
//******************************************************************************
//* DEV SERVER
//******************************************************************************
gulp.task("watch", ["default"], function () {
browserSync.init({
server: "."
});
gulp.watch([ "src/**/**.ts", "test/**/*.ts"], ["default"]);
gulp.watch("dist/*.js").on('change', browserSync.reload);
});
//******************************************************************************
//* DEFAULT
//******************************************************************************
gulp.task("default", function (cb) {
runSequence("lint", "build-test", "test", "build", cb);
});