-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathbuild-init.js
More file actions
34 lines (30 loc) · 877 Bytes
/
build-init.js
File metadata and controls
34 lines (30 loc) · 877 Bytes
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
const shellJS = require("shelljs");
const config = require("./docs.config.js");
const versions = require("./versions.json");
const URL = config.REPO_LINK + ".git";
const FALLBACK_BRANCH = config.REPO_BRANCH;
const FOLDER = "versioned_repo";
const { versionMap } = config;
shellJS.mkdir(FOLDER);
shellJS.cd(FOLDER);
const cloneRepos = () => {
versions.push("next");
for (let i = 0; i < versions.length; i++) {
const v = versions[i];
shellJS.mkdir(v);
shellJS.cd(v);
shellJS.exec("git clone " + URL);
shellJS.cd("NativeBase");
let a = shellJS.exec("git checkout " + "v" + versionMap[v]);
if (a.code !== 0) {
shellJS.exec("git checkout " + FALLBACK_BRANCH);
shellJS.exec("git pull");
}
if (process.env.BUILDING === "prod") {
shellJS.exec("yarn");
}
shellJS.cd("..");
shellJS.cd("..");
}
};
cloneRepos();