-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
60 lines (54 loc) · 1.47 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
var gulp = require("gulp"),
fs = require("fs-extra"),
zip = require("gulp-zip");
gulp.task("zip", async () => {
try {
fs.removeSync("./distribution.zip");
} catch (e) { }
try {
fs.removeSync("./distribution");
} catch (e) { }
try {
fs.removeSync("./example.zip");
} catch (e) { }
try {
fs.removeSync("./example");
} catch (e) { }
fs.copySync("./dist/assets", "./distribution");
await new Promise((resolve, reject) => {
gulp
.src(["./distribution/**/*"])
.pipe(zip("distribution.zip"))
.on("error", reject)
.pipe(gulp.dest("./"))
.on("end", resolve);
});
fs.removeSync("./distribution");
fs.copySync("./dist", "./example");
fs.copySync("./apps", "./example/apps");
fs.copySync("./maps", "./example/maps");
fs.copySync("./pois", "./example/pois");
fs.copySync("./tiles", "./example/tiles");
fs.copySync("./img", "./example/img");
fs.copySync("./pwa", "./example/pwa");
fs.copySync("./tmbs", "./example/tmbs");
await new Promise((resolve, reject) => {
gulp
.src(["./example/**/*"])
.pipe(zip("example.zip"))
.on("error", reject)
.pipe(gulp.dest("./"))
.on("end", resolve);
});
fs.removeSync("./example");
});
gulp.task("git_switch", async () => {
try {
fs.statSync('.git.open');
fs.moveSync('.git', '.git.keep');
fs.moveSync('.git.open', '.git');
} catch(e) {
fs.moveSync('.git', '.git.open');
fs.moveSync('.git.keep', '.git');
}
});