-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.babel.js
30 lines (27 loc) · 1.09 KB
/
gulpfile.babel.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
import gulp from "gulp";
import exists from "path-exists";
import paths from "vinyl-paths";
import del from "del";
import run from "run-sequence";
import jasmine from "gulp-jasmine";
import reporters from "jasmine-reporters";
import typescript from "typescript";
import gts from "gulp-typescript";
import merge from "merge2";
import tsconfig from "./tsconfig.json";
const tsc = gts(Object.assign({ typescript: typescript }, tsconfig.compilerOptions));
const typescriptSources = [ tsconfig.compilerOptions.rootDir + "/**/*.ts" ];
const output = tsconfig.compilerOptions.outDir;
const testSuites = [ "test/**/*.js" ];
const clean = [ output ];
gulp.task("clean", done => gulp.src(clean).pipe(paths(del)));
gulp.task("build-typescript", done => {
let stream = gulp.src(typescriptSources).pipe(tsc);
return merge([
stream.js.pipe(gulp.dest(output)),
stream.dts.pipe(gulp.dest(output))
]);
});
gulp.task("build", done => run("clean", [ "build-typescript" ], done));
gulp.task("test", [ "build" ], done => gulp.src(testSuites).pipe(jasmine()));
gulp.task("default", () => run("build", "test"));