-
Notifications
You must be signed in to change notification settings - Fork 35
/
gulpfile.js
70 lines (60 loc) · 1.81 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
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
const gulp = require("gulp");
const source = require("vinyl-source-stream");
const buffer = require("vinyl-buffer");
const uglify = require("gulp-uglify");
const streamify = require("gulp-streamify");
const size = require("gulp-size");
const concat = require("gulp-concat");
const del = require("del");
const removeCode = require("gulp-remove-code");
const browserify = require("browserify");
function cleanBuild() {
return del(["dist-app/*"]);
}
function cleanTest() {
return del(["spec/functional/public/js/test-app.js"]);
}
function build() {
const b = browserify({
entries: "./src/index.ts",
standalone: "Framebus",
debug: true,
});
return b
.plugin("tsify", { strict: true })
.bundle()
.pipe(source("framebus.min.js"))
.pipe(buffer())
.pipe(removeCode({ production: true }))
.pipe(streamify(size({ showFiles: true })))
.pipe(uglify())
.pipe(gulp.dest("./dist-app/"));
}
function functionalPrep() {
return gulp.series(build, function () {
return gulp
.src([
"dist-app/framebus.min.js",
"spec/functional/public/js/app-support.js",
])
.pipe(concat("test-app.js"))
.pipe(gulp.dest("spec/functional/public/js"));
});
}
function watch() {
gulp.watch(["lib/**/*.js", "index.js"], gulp.task(build));
}
function watchIntegration() {
gulp.watch(["lib/**/*.js", "index.js"], gulp.task(build));
}
function clean() {
return gulp.series(cleanBuild, cleanTest);
}
exports.clean = clean();
exports.functionalTestPrep = functionalPrep();
exports.functionalTestPrep.displayName = "functional:prep";
exports.watchIntegration = watchIntegration;
exports.watchIntegration.displayName = "watch:integration";
exports.watch = watch;