forked from jhipster/prettier-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclone-samples.js
More file actions
110 lines (102 loc) · 2.63 KB
/
clone-samples.js
File metadata and controls
110 lines (102 loc) · 2.63 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { execSync } from "node:child_process";
import { mkdirSync, rmSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const samplesDir = path.resolve(__dirname, "../samples");
const core = [
{
repoUrl: "https://github.com/jhipster/jhipster-sample-app",
branch: "v8.0.0-rc.1"
},
{
repoUrl: "https://github.com/jhipster/jhipster-bom",
branch: "8.0.0-rc.1"
},
{
repoUrl: "https://github.com/spring-projects/spring-boot.git",
branch: "v3.1.5"
},
{
repoUrl: "https://github.com/iluwatar/java-design-patterns.git",
branch: "1.25.0"
}
];
const jhipster1 = [
{
repoUrl: "https://github.com/jhipster/jhipster-sample-app-microservice",
branch: "v8.0.0-rc.1"
},
{
repoUrl: "https://github.com/jhipster/jhipster-sample-app-oauth2",
branch: "v8.0.0-rc.1"
},
{
repoUrl: "https://github.com/jhipster/jhipster-sample-app-websocket",
branch: "v8.0.0-rc.1"
},
{
repoUrl: "https://github.com/jhipster/jhipster-sample-app-noi18n",
branch: "v8.0.0-rc.1"
},
{
repoUrl: "https://github.com/jhipster/jhipster-sample-app-hazelcast",
branch: "v8.0.0-rc.1"
}
];
const jhipster2 = [
{
repoUrl: "https://github.com/jhipster/jhipster-sample-app-elasticsearch",
branch: "v8.0.0-rc.1"
},
{
repoUrl: "https://github.com/jhipster/jhipster-sample-app-dto",
branch: "v8.0.0-rc.1"
},
{
repoUrl: "https://github.com/jhipster/jhipster-sample-app-cassandra",
branch: "v8.0.0-rc.1"
},
{
repoUrl: "https://github.com/jhipster/jhipster-sample-app-mongodb",
branch: "v8.0.0-rc.1"
},
{
repoUrl: "https://github.com/jhipster/jhipster-sample-app-react",
branch: "v8.0.0-rc.1"
}
];
let sampleRepos = core;
if (process.argv.length === 3) {
switch (process.argv[2]) {
case "e2e-core":
break;
case "e2e-jhipster1":
sampleRepos = jhipster1;
break;
case "e2e-jhipster2":
sampleRepos = jhipster2;
break;
}
}
rmSync(samplesDir, { force: true, recursive: true });
mkdirSync(samplesDir);
sampleRepos.forEach(cloneRepo);
function cloneRepo({ repoUrl, branch, commitHash }) {
console.log(`cloning ${repoUrl}`);
if (commitHash) {
execSync(`git clone ${repoUrl} --branch ${branch}`, {
cwd: samplesDir,
stdio: [0, 1, 2]
});
execSync(`git checkout ${commitHash}`, {
cwd: path.resolve(samplesDir, repoUrl.split("/").pop()),
stdio: [0, 1, 2]
});
} else {
execSync(`git clone ${repoUrl} --branch ${branch} --depth 1`, {
cwd: samplesDir,
stdio: [0, 1, 2]
});
}
}