forked from PubMatic/OpenWrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
58 lines (47 loc) · 1.57 KB
/
build.sh
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
#! /usr/bin/env node
console.log("running from shell script");
var shell = require('shelljs');
var argv = require('yargs').argv;
shell.exec("gulp clean");
var prebidRepoPath = argv.prebidpath || "../Prebid.js/";
console.log("ARGV ==>", argv);
if(shell.cd(prebidRepoPath).code !== 0) {
shell.echo("Couldnt change the dir to Prebid repo");
shell.exit(1);
}
var prebidTaskName = "";
var openwrapBuildTaskName = "";
var openwrapWebpackTaskName = "";
if ( argv.mode && argv.mode == "test-build") {
console.log("Executing test-build");
prebidTaskName = "build-bundle-dev --modules=modules.json";
openwrapBuildTaskName = "devbundle";
openwrapWebpackTaskName = "devpack";
} else if ( argv.mode && argv.mode == "build" ) {
console.log("Executing build");
prebidTaskName = "build --modules=modules.json";
openwrapBuildTaskName = "bundle";
openwrapWebpackTaskName = "webpack";
} else {
console.log("No mode supplied, Too few arguments");
shell.exit(1);
}
if(shell.exec("gulp " + prebidTaskName + " --mode=" + argv.mode).code !== 0) {
shell.echo('Error: buidlinng of project failed');
shell.exit(1);
}
shell.cd("../OpenWrap/");
if (argv.mode == "test-build") {
if(shell.exec("gulp testall" + " --mode=" + argv.mode).code !== 0) {
shell.echo('Error: test cases failed');
shell.exit(1);
}
}
if(shell.exec("gulp " + openwrapWebpackTaskName + " --mode=" + argv.mode).code !== 0) {
shell.echo('Error: webpack task failed');
shell.exit(1);
}
if(shell.exec("gulp " + openwrapBuildTaskName + " --mode=" + argv.mode).code !== 0) {
shell.echo('Error: build task failed');
shell.exit(1);
}