|
@@ -21,8 +21,16 @@ const dirNameBlackList = [
|
|
|
"ThirdParty",
|
|
"ThirdParty",
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
|
|
+class RepItem
|
|
|
|
|
+{
|
|
|
|
|
+ constructor(inPath, inUrl) {
|
|
|
|
|
+ this.path = inPath; // 仓库名称
|
|
|
|
|
+ this.url = inUrl; // 仓库地址
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
class RepUrls{
|
|
class RepUrls{
|
|
|
- repUrls = [];
|
|
|
|
|
|
|
+ RepItems = [];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 拉取 Git 仓库最新代码到指定路径
|
|
// 拉取 Git 仓库最新代码到指定路径
|
|
@@ -150,19 +158,21 @@ function cloneRep()
|
|
|
let inputRepURLJsonFile = path.join(rootPath, InputRepURLJsonName);
|
|
let inputRepURLJsonFile = path.join(rootPath, InputRepURLJsonName);
|
|
|
if(!fs.existsSync(inputRepURLJsonFile)) {
|
|
if(!fs.existsSync(inputRepURLJsonFile)) {
|
|
|
let temp = new RepUrls();
|
|
let temp = new RepUrls();
|
|
|
- temp.repUrls = ["https://xxx.com/test/url.git"];
|
|
|
|
|
|
|
+ temp.RepItems = [new RepItem("cpp", "https://xxx.com/test/url.git")];
|
|
|
fs.writeFileSync(inputRepURLJsonFile, JSON.stringify(temp, null, 4), "utf-8");
|
|
fs.writeFileSync(inputRepURLJsonFile, JSON.stringify(temp, null, 4), "utf-8");
|
|
|
console.error(`找不到 ${InputRepURLJsonName} 文件,已生成该文件,请填充内容`);
|
|
console.error(`找不到 ${InputRepURLJsonName} 文件,已生成该文件,请填充内容`);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
let repUrls = JSON.parse(fs.readFileSync(inputRepURLJsonFile, "utf-8"));
|
|
let repUrls = JSON.parse(fs.readFileSync(inputRepURLJsonFile, "utf-8"));
|
|
|
- repUrls.repUrls.forEach((url) => {
|
|
|
|
|
|
|
+ repUrls.RepItems.forEach((item) => {
|
|
|
|
|
+ let url = item.url;
|
|
|
|
|
+ let relativePath = item.path;
|
|
|
if(!url || url.trim() === "") {
|
|
if(!url || url.trim() === "") {
|
|
|
console.error(`无效的 Git 仓库 URL: ${url}`);
|
|
console.error(`无效的 Git 仓库 URL: ${url}`);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- let locationPath = path.join(rootPath, PluginDirName);
|
|
|
|
|
|
|
+ let locationPath = path.join(rootPath, PluginDirName, relativePath);
|
|
|
let localPath = path.join(locationPath, path.basename(url, ".git"));
|
|
let localPath = path.join(locationPath, path.basename(url, ".git"));
|
|
|
pullGitRepository(url, localPath);
|
|
pullGitRepository(url, localPath);
|
|
|
});
|
|
});
|