-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.js
More file actions
72 lines (69 loc) · 1.43 KB
/
install.js
File metadata and controls
72 lines (69 loc) · 1.43 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const exec = require('child-process-promise').exec
const apps = [
{
name: 'pp-mp-order',
npm: true,
bower: true
},
{
name: 'pp-mp-delayed-order',
npm: true,
bower: true
},
{
name: 'pp-mp-connected-path',
npm: true,
bower: true
},
{
name: 'pp-mp-managed-path',
npm: true,
bower: true
},
{
name: 'pp-mp-billing-agreements',
npm: true,
bower: true
}
]
function callback(err, result) {
if(err) {
console.log('-- AN ERROR OCCURRED --')
console.log(err)
} else {
if(result.npm === true) {
console.log(result.name + ' NPM packages installed successfully!')
} else {
console.log('NO NPM packages to install!')
}
if(result.bower === true) {
console.log(result.name + ' BOWER packages installed successfully!')
} else {
console.log('NO BOWER packages to install!')
}
}
}
exec('npm install; npm install bower;')
.then((result) => {
console.log('pp-mp-examples NPM packages installed successfully')
apps.forEach((myApp) => {
let command = 'cd ' + myApp.name + '; '
if(myApp.npm === true) {
command += 'npm install; '
}
if(myApp.bower === true) {
command += 'bower install;'
}
exec(command)
.then((result) => {
callback(null, myApp)
})
.catch((err) => {
callback(err)
});
});
})
.catch((err) => {
console.log('ERROR while installing packages for pp-mp-examples')
console.log(err)
})