-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinstall.js
More file actions
81 lines (78 loc) · 2.25 KB
/
install.js
File metadata and controls
81 lines (78 loc) · 2.25 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
73
74
75
76
77
78
79
80
81
var exec = require('child-process-promise').exec;
/*
* apps array
*
* note: You must add new apps here to make them part of the install process.
*
* name: 'string', name of the directory e.g. 'simple-express-server'
* npm: 'boolean', true or false. (if npm installs are needed, set to true)
* bower: 'boolean', true of false. (if bower installs are needed, set to true)
*
*/
var apps = [
{
name: 'simple-express-server',
npm: true,
bower: false
},
{
name: 'express-in-context',
npm: true,
bower: false
},
{
name: 'kraken-in-context',
npm: true,
bower: false
},
{
name: 'kraken-angular-in-context',
npm: true,
bower: true
},
{
name: 'hapi-in-context',
npm: true,
bower: true
}
];
function callback(err, result) {
if(err){
console.log('----- AN ERROR OCCURED -----');
console.log(err);
} else {
if(result.npm === true){
console.log(result.name + ' NPM packages installed!');
} else {
//no output
}
if(result.bower === true){
console.log(result.name + ' bower packages installed!');
} else {
//no output
}
}
}
exec('npm install;')
.then(function (result0) {
console.log('node-app-examples NPM packages installed!');
apps.forEach(function (application) {
var command = 'cd ' + application.name + '; ';
if(application.npm === true) {
command += 'npm install; ';
}
if(application.bower === true) {
command += 'bower install;'
}
exec(command)
.then(function (result) {
callback(null, application);
})
.catch(function (err) {
callback(err);
});
});
})
.catch(function (err) {
console.log('ERROR while installing NPM packages for node-app-examples');
});