-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
56 lines (48 loc) · 1.3 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
"use strict";
var gulp = require("gulp"),
tslint = require("gulp-tslint"),
tsc = require("gulp-typescript"),
runSequence = require("run-sequence"),
sourcemaps = require('gulp-sourcemaps'),
merge = require('merge2');
gulp.task("lint", function() {
var config = { formatter: "verbose", emitError: (process.env.CI) ? true : false };
return gulp.src([
"./**/**.ts",
"!./**/*.d.ts",
"!./node_modules/**/*.ts"
])
.pipe(tslint(config))
.pipe(tslint.report());
});
var tsProject = tsc.createProject("tsconfig.json");
gulp.task("build", ["lint"], function() {
var tsResults = gulp.src([
"./src/**/**.ts",
"!./src/**/*.d.ts",
"index.ts",
"typings/main.d.ts"
],
{
base: "."
})
.pipe(sourcemaps.init())
.pipe(tsProject())
.on("error", function(err) {
process.exit(1);
});
return merge([
tsResults.dts.pipe(gulp.dest('.')),
tsResults.js.pipe(sourcemaps.write('./')).pipe(gulp.dest('./'))
]);
});
gulp.task("watch", ["default"], function() {
gulp.watch([
"./**/*.ts",
"!./**/*.d.ts",
"!./node_modules/**/*.ts"
], ["default"]);
});
gulp.task("default", function(cb) {
runSequence("build", cb);
});