-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
78 lines (69 loc) · 1.99 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
var gulp = require("gulp"),
watch = require("gulp-watch"),
tslint = require("gulp-tslint"),
tsc = require("gulp-typescript");
//******************************************************************************
//* LINT
//******************************************************************************
gulp.task("lint", function() {
var config = {
formatter: "verbose",
emitError: process.env.CI ? true : false
};
return gulp
.src(["src/**/**.ts", "spec/**/**.spec.ts"])
.pipe(tslint(config))
.pipe(tslint.report());
});
//******************************************************************************
//* BUILD
//******************************************************************************
var tsLibProject = tsc.createProject("tsconfig.json", {
module: "commonjs",
typescript: require("typescript")
});
gulp.task("default", ["build-lib", "build-dts"]);
gulp.task("build-lib", function() {
return gulp
.src(["src/**/*.ts"])
.pipe(tsLibProject())
.on("error", function(err) {
process.exit(1);
})
.js.pipe(gulp.dest("lib/"));
});
var tsDtsProject = tsc.createProject("tsconfig.json", {
declaration: true,
noResolve: false,
typescript: require("typescript")
});
gulp.task("build-dts", function() {
return gulp
.src(["src/**/*.ts"])
.pipe(tsDtsProject())
.on("error", function(err) {
process.exit(1);
})
.dts.pipe(gulp.dest("dts"));
});
//******************************************************************************
//* WATCH
//******************************************************************************
gulp.task("watch", function () {
return watch("src/**/*.ts", function () {
gulp
.src(["src/**/*.ts"])
.pipe(tsLibProject())
.on("error", function (err) {
process.exit(1);
})
.js.pipe(gulp.dest("lib/"));
gulp
.src(["src/**/*.ts"])
.pipe(tsDtsProject())
.on("error", function (err) {
process.exit(1);
})
.dts.pipe(gulp.dest("dts"))
});
});