mirror of
https://github.com/NovaGM/ModuleBuilder.git
synced 2024-08-15 00:23:33 +00:00
[Caching] Fix sub module support
This commit is contained in:
parent
3487624ac0
commit
0b6001b70f
1 changed files with 13 additions and 7 deletions
20
src/index.js
20
src/index.js
|
@ -101,8 +101,19 @@ for (const parentRepo of ModuleRepos) {
|
|||
for (const repo of parentRepo.modules) {
|
||||
console.time(repo.slice(0, 2).join(' @ ')+`${repo[2] ? ` ${repo[2]}` : ''}`);
|
||||
|
||||
const name = repo[0];
|
||||
const cloneDir = `${clonesDir}/${name}`;
|
||||
const moduleDir = repo[2] || '';
|
||||
|
||||
if (previous.includes(repo)) {
|
||||
const currentModule = currentRepoJson.modules.find((x) => x.github.repo === repo[0])
|
||||
let currentModule = currentRepoJson.modules.filter((x) => x.github.repo === repo[0]);
|
||||
if (currentModule.length > 1) {
|
||||
const manifest = JSON.parse(readFileSync(`${cloneDir}${moduleDir}/goosemodModule.json`));
|
||||
|
||||
currentModule = currentModule.find((x) => x.name === manifest.name);
|
||||
} else {
|
||||
currentModule = currentModule[0];
|
||||
}
|
||||
|
||||
moduleJson.modules.push(currentModule);
|
||||
|
||||
|
@ -115,11 +126,6 @@ for (const parentRepo of ModuleRepos) {
|
|||
|
||||
const githubInfo = await getGithubInfo(repo[0]);
|
||||
|
||||
const name = repo[0];
|
||||
const cloneDir = `${clonesDir}/${name}`;
|
||||
|
||||
const moduleDir = repo[2] || '';
|
||||
|
||||
// console.log(repo);
|
||||
|
||||
const url = `https://github.com/${repo[0]}.git`;
|
||||
|
@ -130,7 +136,7 @@ for (const parentRepo of ModuleRepos) {
|
|||
// resetDir(cloneDir);
|
||||
// rmSync(cloneDir, { recursive: true, force: true });
|
||||
|
||||
if (existsSync(cloneDir)) rmSync(cloneDir, { recursive: true, force: true });
|
||||
// if (existsSync(cloneDir)) rmSync(cloneDir, { recursive: true, force: true });
|
||||
|
||||
await new Promise((res) => exec(`git clone ${url} ${cloneDir}`, res));
|
||||
|
||||
|
|
Loading…
Reference in a new issue