-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
70 lines (62 loc) · 1.88 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
const gulp = require("gulp");
const jeditor = require("gulp-json-editor");
const mergeStream = require("merge-stream");
const PolymerProject = require("polymer-build").PolymerProject;
const git = require("gulp-git");
gulp.task("polymer.build", function() {
process.chdir("public");
const project = new PolymerProject(require("./public/polymer.json"));
mergeStream(project.sources(), project.dependencies())
.pipe(project.bundler)
.pipe(gulp.dest("../build/"))
.on("finish", () => {
process.chdir("./..");
});
});
gulp.task('conig.dev', function() {
return gulp.src('config.json')
.pipe(jeditor({
'folder': './public'
}))
.pipe(gulp.dest('.'));
});
gulp.task('config.prod', ['polymer.build'], function() {
return gulp.src('config.json')
.pipe(jeditor({
'folder': './build'
}))
.pipe(gulp.dest('.'));
});
gulp.task("commit.prod", function() {
const p = require("./package.json")
const v = p.version.split(".");
v[2] = parseInt(v[2]) + 1;
const version = v.join(".");
gulp.src("package.json")
.pipe(jeditor({
"version": version,
}))
.pipe(gulp.dest("."))
.pipe(gulp.src("./*"))
.pipe(git.add({args: "-f"}))
.on('finish', function() {
git.commit("version " + version)
.on('finish', function() {
git.push('origin', 'master');
});
});
});
gulp.task("commit.dev", function() {
gulp.src("./*")
.pipe(git.add({args: "-f"}))
.on('finish', function() {
git.commit("dev")
.on('finish', function() {
git.push('origin', 'master');
});
});
});
gulp.task("dev", ["config.dev", "commit.dev"], function() {
});
gulp.task("prod", ["polymer.build", "config.prod", "commit.prod"], function() {
});