-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathgulpfile.js
49 lines (43 loc) · 1.27 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
let gulp = require("gulp"),
isWin = /^win/.test(process.platform),
commandSeparator = isWin ? "&" : ";",
webpack = require("webpack"),
exec = require("child_process").exec,
stage = null;
function runCommand(cmd, done) {
let ls = exec(cmd);
ls.stdout.on("data", function(data) {
console.log(data);
});
ls.stderr.on("data", function(data) {
console.log(data);
});
ls.on("close", function(data) {
done && done();
});
}
/* Install dynamodb local instance */
gulp.task("install-dynamodb", function(done) {
runCommand("cd api" + commandSeparator + " sls dynamodb install", done);
});
/* Start dynamodb local instance */
gulp.task("start-dynamodb", function(done) {
runCommand("cd api" + commandSeparator + " sls dynamodb start", done);
});
/* Start offline server for local development */
gulp.task("start-offline-server", function(done) {
runCommand(
"cd api " +
commandSeparator +
"cd todo " +
commandSeparator +
"serverless offline start",
done
);
});
/* Start offline server for local development */
gulp.task("start-client", function(done) {
runCommand("cd web " + commandSeparator + "npm run start", done);
});
/* Start application locally */
gulp.task("serve", gulp.parallel("start-offline-server", "start-client"));