forked from 99x/serverless-react-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgulpfile.js
More file actions
49 lines (42 loc) · 1.5 KB
/
gulpfile.js
File metadata and controls
49 lines (42 loc) · 1.5 KB
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
var gulp = require('gulp'),
isWin = /^win/.test(process.platform),
commandSeparator = isWin ? '&' : ';',
webpack = require('webpack'),
exec = require('child_process').exec,
util = require('gulp-util'),
gulpSequence = require('gulp-sequence'),
stage = null;
function runCommand(cmd, done) {
var 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 serverless' + commandSeparator + ' sls dynamodb install', done);
});
/* Start dynamodb local instance */
gulp.task('start-dynamodb', function(done) {
runCommand('cd serverless' + commandSeparator + ' sls dynamodb start', done);
});
/* Start offline server for local development */
gulp.task('start-offline-server', function(done) {
runCommand('cd serverless ' + commandSeparator + 'serverless offline start', done);
});
/* Start offline server for local development */
gulp.task('start-client', function(done) {
runCommand('cd web ' + commandSeparator + 'webpack-dev-server', done);
});
/* Start offline server for local development */
gulp.task('open-website', function(done) {
require("opn")("http://localhost:8080");
});
/* Start application locally */
gulp.task('serve', gulpSequence(['start-offline-server', 'start-client', 'open-website']));