This repository has been archived by the owner on Oct 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
76 lines (64 loc) · 1.89 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
const browserify = require("browserify");
const gulp = require("gulp");
const less = require("gulp-less");
const mocha = require("gulp-mocha");
const runSequence = require("run-sequence");
const source = require("vinyl-source-stream");
const ts = require("gulp-typescript");
const tslint = require("gulp-tslint");
gulp.task("browserify", () => {
const browsering = browserify(
"src/site/scripts/main.js",
{
insertGlobals: true,
debug: true
});
return browsering
.bundle()
.pipe(source("main.js"))
.pipe(gulp.dest("src/site/scripts/bundled"));
});
gulp.task("less", () => {
return gulp.src("src/site/**/*.less")
.pipe(less())
.pipe(gulp.dest("src/site"));
});
gulp.task("test", () => {
return gulp
.src("test/tests.js")
.pipe(mocha({
reporter: "spec"
}));
});
gulp.task("tsc:server", () => {
const tsProject = ts.createProject(
"tsconfig.json",
{
module: "none"
});
return gulp.src("src/server/**/*.ts")
.pipe(ts(tsProject))
.js.pipe(gulp.dest("src/server"));
});
gulp.task("tsc:site", () => {
const tsProject = ts.createProject("tsconfig.json");
return gulp.src("src/site/**/*.ts")
.pipe(ts(tsProject))
.js.pipe(gulp.dest("src/site"));
});
gulp.task("tsc", callback => {
runSequence(["tsc:server", "tsc:site"], callback);
});
gulp.task("tslint", () => {
return gulp
.src(["src/**/*.ts", "src/**/*.tsx", "!src/**/*.d.ts"])
.pipe(tslint())
.pipe(tslint.report("verbose"));
});
gulp.task("watch", () => {
gulp.watch(["*.json", "src/**/*.ts","src/**/*.tsx"], ["tsc", "tslint", "browserify"]);
gulp.watch(["src/site/**/*.less"], ["less"]);
});
gulp.task("default", ["less", "tsc", "tslint"], callback => {
runSequence(["browserify", "test"], callback);
});