forked from krausest/js-framework-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
31 lines (28 loc) · 1.01 KB
/
build.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
var _ = require('lodash');
var exec = require('child_process').execSync;
var fs = require('fs');
var path = require('path');
var excludedDirectories = ['css', 'images', 'dist','node_modules','webdriver-java'];
// set the following variable to resume building with a framework and skip all
// other frameworks that would be buils before
var restartWithFramework = '';
var build = !restartWithFramework ? true : false;
_.each(fs.readdirSync('.'), function(name) {
if(!name.startsWith(".") && fs.statSync(name).isDirectory() && excludedDirectories.indexOf(name)==-1 && fs.existsSync(path.join(name, "package.json"))) {
if (!build && name.startsWith(restartWithFramework)) build = true;
if (build) {
console.log("*** Executing npm install in "+name);
exec('npm install', {
cwd: name,
stdio: 'inherit'
});
console.log("*** Executing npm run build-prod in "+name);
exec('npm run build-prod', {
cwd: name,
stdio: 'inherit'
});
} else {
console.log("*** Skipping "+name);
}
}
});