-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
83 lines (71 loc) · 2.63 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
79
80
81
82
83
"use strict";
//******************************************************************************
//* DEPENDENCIES
//******************************************************************************
var gulp = require("gulp"),
tslint = require("gulp-tslint"),
tsc = require("gulp-typescript"),
runSequence = require("run-sequence"),
browserify = require("browserify"),
source = require("vinyl-source-stream"),
buffer = require("vinyl-buffer");
//******************************************************************************
//* LINT ALL
//******************************************************************************
gulp.task("lint", function() {
var config = { emitError: (process.env.CI) ? true : false };
return gulp.src([
"src/**/**.ts",
"test/**/**.test.ts"
])
.pipe(tslint())
.pipe(tslint.report("verbose", config));
});
//******************************************************************************
//* BUILD SOURCE
//******************************************************************************
var tsLibProject = tsc.createProject("tsconfig.json");
gulp.task("build", function() {
return gulp.src([
"typings/index.d.ts",
"node_modules/immutable/dist/immutable.d.ts",
"node_modules/redux-bootstrap/type_definitions/redux-bootstrap/redux-bootstrap.d.ts",
"node_modules/inversify/type_definitions/inversify/inversify.d.ts",
"node_modules/inversify-dts/inversify-logger-middleware/inversify-logger-middleware.d.ts",
"src/interfaces/interfaces.d.ts",
"src/**/**.ts",
"src/**/**.tsx"
])
.pipe(tsc(tsLibProject))
.on("error", function (err) {
process.exit(1);
})
.js.pipe(gulp.dest("lib/"));
});
//******************************************************************************
//* BUNDLE SOURCE
//******************************************************************************
gulp.task("bundle", function() {
var mainFilePath = "lib/main.js";
var outputFolder = "bundle";
var outputFileName = "app.js";
var bundler = browserify({
debug: true
});
// TS compiler options are in tsconfig.json file
return bundler.add(mainFilePath)
.bundle()
.pipe(source(outputFileName))
.pipe(buffer())
.pipe(gulp.dest(outputFolder));
});
//******************************************************************************
//* TASK GROUPS
//******************************************************************************
gulp.task("default", function (cb) {
runSequence(
"lint",
"build",
"bundle",
cb);
});