-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
91 lines (69 loc) · 2.37 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
89
90
91
var gulp = require("gulp");
var babel = require("gulp-babel");
var uglify = require("gulp-uglify");
var sass = require("gulp-sass");
var exec = require("child_process").exec;
var del = require("del");
var parameters = require("./config/parameters");
//Server Tasks
gulp.task("server:copy-js", function() {
gulp.src([parameters.server.serverAppPath + "/src/**/*.js"])
.pipe(babel())
.pipe(gulp.dest(parameters.server.distFolder + "/src"));
gulp.src("./" + parameters.server.serverJsFile)
.pipe(babel())
.pipe(gulp.dest(parameters.server.distServerJsFolder));
});
gulp.task("start", (cb) => {
exec("./node_modules/forever/bin/forever start -w dist/app.js", (err, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task("stop", (cb) => {
exec("./node_modules/forever/bin/forever stop dist/app.js", (err, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
cb();
});
});
gulp.task("restart", (cb) => {
exec("./node_modules/forever/bin/forever restart dist/server.js", (err, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task("list", (cb) => {
exec("./node_modules/forever/bin/forever list", (err, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task("server:clean", function () {
del(parameters.server.distFolder);
del(parameters.server.distServerJsFolder + '/' + parameters.server.serverJsFile);
});
//Client Tasks
gulp.task("client:copy-resources", function() {
gulp.src(parameters.client.hbsFolder + "/**/*.*")
.pipe(gulp.dest(parameters.client.distFolder+"/views"));
gulp.src(parameters.client.imgSrcPath + "/**/*.*")
.pipe(gulp.dest(parameters.client.distFolder + "/images"));
return gulp.src(parameters.client.fontsPath + "/**/*.*")
.pipe(gulp.dest(parameters.client.distFolder + "/fonts"));
});
gulp.task("client:clean", function() {
del(parameters.client.distFolder);
});
//Aggregate tasks
gulp.task("clean", function () {
del(parameters.other.distFolder);
});
gulp.task("build", ["client:copy-resources","server:copy-js"] );
gulp.task("watch", function () {
gulp.watch(parameters.server.serverAppPath + "**/**/*.*",['build']);
gulp.watch(parameters.client.clientAppPath + "**/**/*.*",['build']);
});