-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
56 lines (45 loc) · 1.23 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
const gulp = require("gulp");
const exec = require("gulp-exec");
const del = require("del");
const Tasks = Object.freeze({
Clean: "Clean",
BuildClient: "BuildClient",
BuildFunctions: "BuildFunctions",
BuildServerAndClient: "BuildServerAndClient"
});
const DIST_FOLDER = "dist";
const FUNCTIONS_FOLDER = "functions";
gulp.task(Tasks.BuildClient, () => {
return gulp
.src(".")
.pipe(exec("npm run build:prod"));
});
/**
* Compiles Server and client by executing the build:prod command specified in the package.json file
*/
gulp.task(Tasks.BuildServerAndClient, () => {
return gulp
.src(".")
.pipe(exec("npm run build:ssr:prod"));
});
gulp.task(Tasks.BuildFunctions, () => {
return gulp
.src(FUNCTIONS_FOLDER)
.pipe(exec("npm run build", {
cwd: `${FUNCTIONS_FOLDER}/`
}));
});
gulp.task(Tasks.Clean, () => {
return del([
`${DIST_FOLDER}/**`,
`${FUNCTIONS_FOLDER}/lib/**`,
`${FUNCTIONS_FOLDER}/dist/**`
]);
});
gulp.task("default", (done) => {
return gulp.series(
Tasks.Clean,
Tasks.BuildServerAndClient,
Tasks.BuildFunctions
)(done);
});