mirror of
https://github.com/NovaGM/ModuleBuilder.git
synced 2024-08-15 00:23:33 +00:00
[Caching] Fix updating hash sometimes failing due to cwd bug
This commit is contained in:
parent
0b6001b70f
commit
4268f099b5
1 changed files with 9 additions and 1 deletions
10
src/index.js
10
src/index.js
|
@ -136,8 +136,16 @@ for (const parentRepo of ModuleRepos) {
|
||||||
// resetDir(cloneDir);
|
// resetDir(cloneDir);
|
||||||
// rmSync(cloneDir, { recursive: true, force: true });
|
// rmSync(cloneDir, { recursive: true, force: true });
|
||||||
|
|
||||||
// if (existsSync(cloneDir)) rmSync(cloneDir, { recursive: true, force: true });
|
if (existsSync(cloneDir)) {
|
||||||
|
process.chdir(cloneDir);
|
||||||
|
|
||||||
|
const currentHash = await new Promise((res) => exec(`git rev-parse HEAD`, (err, stdout) => res(stdout.trim())));
|
||||||
|
|
||||||
|
if (currentHash !== repo[1]) rmSync(cloneDir, { recursive: true, force: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
process.chdir(distDir); // Incase current wd is broken, in which case exec / git crashes
|
||||||
|
|
||||||
await new Promise((res) => exec(`git clone ${url} ${cloneDir}`, res));
|
await new Promise((res) => exec(`git clone ${url} ${cloneDir}`, res));
|
||||||
|
|
||||||
process.chdir(cloneDir);
|
process.chdir(cloneDir);
|
||||||
|
|
Loading…
Reference in a new issue