-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
73 lines (54 loc) · 1.99 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
const { parallel, series } = require('gulp')
const { src, dest } = require('gulp')
const exec = require('child_process').exec;
function installServerDep(cb) {
let instServDep = exec('cd ./server && npm install');
instServDep.stdout.on('data', function(data) {
console.log(data)
});
instServDep.on('close', function(code) {
console.log(`---------------------Server Dependencies Installation Complete with code: ${code}--------------------`)
cb(code)
});
}
function installUIDep(cb) {
let instUIDep = exec('cd ./ui && npm install')
instUIDep.stdout.on('data', function(data) {
console.log(data);
});
instUIDep.on('close', function(code) {
console.log(`---------------------UI Dependencies Installation complete with code ${code}--------------------`)
cb(code)
});
}
function buildUI(cb) {
let bldUI = exec('cd ./ui && npm run ng -- build')
bldUI.stdout.on('data', function(data) {
console.log(data)
});
bldUI.stderr.on('data', function(data) {
console.log(data)
});
bldUI.on('close', function(code) {
console.log(`---------------------UI build complete with code ${code}--------------------`)
cb(code)
})
}
function copyUItoServerPath(cb) {
src('./ui/dist/project-manager/*').pipe(dest('./server/public/')).on('end', function( ) {
console.log(`------------------Built files copied to public folder------------------------`)
cb()
})
}
function startServer(cb) {
let stServer = exec('cd ./server && npm start')
stServer.stdout.on('data', function(data) {
console.log(data);
cb()
})
}
exports.depinstall = parallel(installServerDep, installUIDep)
exports.build = series(buildUI, copyUItoServerPath)
exports.buildstart = series(buildUI, copyUItoServerPath, startServer)
exports.start = series(startServer)
exports.default = series(parallel(installServerDep, installUIDep), buildUI, copyUItoServerPath, startServer)