-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
68 lines (58 loc) · 1.88 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
const Gulp = require("gulp")
const Clean = require("gulp-clean")
const GulpTypescript = require("gulp-typescript")
const Merge = require("merge2")
const Typedoc = require("gulp-typedoc")
const Istanbul = require("gulp-istanbul")
const Mocha = require("gulp-mocha")
let TsProject = GulpTypescript.createProject("tsconfig.json")
let TsProjectIndex = GulpTypescript.createProject("tsconfig.json")
let TsProjectTests = GulpTypescript.createProject("tsconfig.json")
Gulp.task("compile-source", () => {
let res = Gulp.src("src/api/**/*.ts")
.pipe(TsProject());
return Merge([
res.js.pipe(Gulp.dest("src/api")),
res.dts.pipe(Gulp.dest("types/api"))
])
})
Gulp.task("compile",["compile-source"],() => {
let res = Gulp.src("src/*.ts")
.pipe(TsProjectIndex());
return Merge([
res.js.pipe(Gulp.dest("src")),
res.dts.pipe(Gulp.dest("types"))
])
})
Gulp.task("compile-tests", ["compile"], () => {
//let res = TsProject.src()
let res = Gulp.src("src/tests/**/*.ts")
.pipe(TsProjectTests());
return res.js.pipe(Gulp.dest("src/tests"))
})
Gulp.task("pre-tests", ["compile-tests"], () => {
return Gulp.src(['src/api/**/*.js'])
.pipe(Istanbul())
.pipe(Istanbul.hookRequire())
})
Gulp.task('test',["tests"]);
Gulp.task('tests', ["pre-tests"], () => {
return Gulp.src('src/tests/**/*.js')
// .pipe(Istanbul())
// .pipe(Istanbul.hookRequire())
.pipe(Mocha({
reporter: 'spec',
timeout: 10000
}))
.pipe(Istanbul.writeReports({
reporters: ['lcov', 'text', 'text-summary']
}))
})
Gulp.task("doc-clean",() => {
return Gulp.src('docs', {read: false})
.pipe(Clean())
})
Gulp.task("doc",["doc-clean"],() => {
console.log("\nPlease use: rm -rf docs && node_modules/typedoc-md-theme/bin/typedoc --options typedoc.json --source src/\n")
})
Gulp.task("default", ["compile"])