-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
72 lines (63 loc) · 1.95 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
var gulp = require("gulp"),
browserify = require("browserify"),
source = require("vinyl-source-stream"),
tslint = require("gulp-tslint"),
tsc = require("gulp-typescript"),
sourcemaps = require("gulp-sourcemaps"),
uglify = require("gulp-uglify"),
runSequence = require("run-sequence"),
mergeStream = require("merge-stream"),
mocha = require("gulp-mocha"),
istanbul = require("gulp-istanbul")
del = require('del'),
jsonminify = require('gulp-jsonminify'),
include = require("gulp-include");
var SRC_PATH = "./src";
var DIST_PATH = "./dist";
gulp.task("lint", function () {
return gulp.src([
SRC_PATH + "/**/**.ts",
])
.pipe(tslint({
formatter: "verbose"
}))
.pipe(tslint.report());
});
////////// BUILD //////////
gulp.task("build-ts", function () {
var tsProject = tsc.createProject("tsconfig.json");
return gulp.src([
SRC_PATH + "/**/*.ts",
], {base: "./"})
.pipe(sourcemaps.init())
.pipe(tsProject())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest("./"));
});
gulp.task("build", function (cb) {
return runSequence(["build-ts"], cb);
});
////////// PUBLISH //////////
gulp.task("transfer-misc", function () {
return gulp.src([
SRC_PATH + "/*.html",
SRC_PATH + "/data/**/*",
SRC_PATH + "/**/*.js",
], {base: SRC_PATH + "/"})
.pipe(include())
.pipe(gulp.dest(DIST_PATH));
});
gulp.task("transfer-minify-json", function () {
return gulp.src([DIST_PATH + "/**/*.json"], {base: "./"})
.pipe(jsonminify())
.pipe(gulp.dest("./"));
});
gulp.task("transfer", function (cb) {
return runSequence("transfer-misc", "transfer-minify-json", cb);
});
gulp.task("cleanup-dist", function () {
return del([DIST_PATH + "/*.html"], [DIST_PATH + "/**/*.js"]);
});
gulp.task("publish", function (cb) {
return runSequence("build", "cleanup-dist", "transfer", cb);
});