-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
31 lines (27 loc) · 924 Bytes
/
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
const gulp = require("gulp");
const fontAwesome = require("gulp-fontawesome");
const through2 = require("gulp-through2");
gulp.task("default", () =>
gulp.src("src/app/**/*.tsx")
.pipe(fontAwesome())
.pipe(gulp.dest("src/icon"))
);
function pad(n) {
return (n < 10 ? "0" : "") + n;
}
gulp.task("syncVer", async () => {
const pkg = await require("./package.json");
const match = pkg.version.match(/\d+/g);
return gulp.src("src/core/RFVersion.h")
.pipe(through2(content => {
const newContent = content
.replace(/(?<=VERSION_MAJOR )\d+/, match[0])
.replace(/(?<=VERSION_MINOR )\d+/, match[1])
.replace(/(?<=VERSION_BUGFIX )\d+/, match[2]);
if(newContent === content) return null;
const now = new Date();
const today = now.getFullYear() + pad(now.getMonth() + 1) + pad(now.getDate());
return newContent.replace(/(?<=VERSION_BUILD )\d+/, today);
}))
.pipe(gulp.dest("src/core"));
});