This repository has been archived by the owner on Jul 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 290
/
gulpfile.js
91 lines (76 loc) · 2.48 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
84
85
86
87
88
var gulp = require("gulp"),
replace = require("gulp-replace"),
bump = require("gulp-bump"),
rename = require("gulp-rename"),
del = require("del"),
css = require("gulp-clean-css"),
js = require("gulp-uglify");
gulp.task("css", ["clean"], function() {
return gulp.src("./src/stable/css/tableexport.css")
.pipe(gulp.dest("./dist/css/"))
.pipe(css())
.pipe(rename({
suffix: ".min"
}))
.pipe(gulp.dest("./dist/css/"))
.pipe(gulp.dest("./src/stable/css/"));
});
gulp.task("js", ["clean"], function() {
return gulp.src("./src/stable/js/tableexport.js")
.pipe(gulp.dest("./dist/js/"))
.pipe(js({ output: { comments: /^!|@preserve|@license|@cc_on/i } }))
.pipe(rename({
suffix: ".min"
}))
.pipe(gulp.dest("./dist/js/"))
.pipe(gulp.dest("./src/stable/js/"));
});
gulp.task("bump-all", ["bump", "bump-js", "bump-css", "bump-typings", "bump-readme"]);
gulp.task("bump", function() {
return gulp.src(["./bower.json", "./package.json"])
.pipe(bump())
.pipe(gulp.dest("./"));
});
gulp.task("bump-js", function() {
return gulp.src(["src/stable/js/tableexport.js"])
.pipe(replace(/(v\d+\.\d+\.)(\d+)/g, function(matches, match1, match2) {
return match1 + (Number(match2) + 1);
}))
.pipe(replace(/(version: ["']\d+\.\d+\.)(\d+)/g, function(matches, match1, match2) {
return match1 + (Number(match2) + 1);
}))
.pipe(gulp.dest("src/stable/js/"))
.on("end", function() {
gulp.start("js");
});
});
gulp.task("bump-css", function() {
gulp.src(["src/stable/css/tableexport.css"])
.pipe(replace(/(v\d+\.\d+\.)(\d+)/g, function(matches, match1, match2) {
return match1 + (Number(match2) + 1);
}))
.pipe(gulp.dest("src/stable/css/"))
.on("end", function() {
gulp.start("css");
});
});
gulp.task("bump-typings", function() {
gulp.src(["dist/tableexport.d.ts"])
.pipe(replace(/(v\d+\.\d+\.)(\d+)/g, function(matches, match1, match2) {
return match1 + (Number(match2) + 1);
}))
.pipe(gulp.dest("dist/"));
});
gulp.task("bump-readme", function() {
gulp.src(["gitbook/README.md", "gitbook/READMEv3.md"])
.pipe(replace(/([/\[`]v?[124567890]\d*\.\d+\.)(\d+)/g, function(matches, match1, match2) {
return match1 + (Number(match2) + 1);
}))
.pipe(gulp.dest("gitbook/"));
});
gulp.task("clean", function() {
return del(["dist/css", "dist/js"]);
});
gulp.task("test", ["build"]);
gulp.task("build", ["css", "js"]);
gulp.task("default", ["build"]);