mirror of
https://github.com/NovaGM/ModuleBuilder.git
synced 2024-08-15 00:23:33 +00:00
[Index] Add lastUpdated to manifests, tweak caching
This commit is contained in:
parent
d209c0665e
commit
1147791ce8
1 changed files with 9 additions and 3 deletions
12
src/index.js
12
src/index.js
|
@ -141,23 +141,27 @@ for (const parentRepo of ModuleRepos) {
|
|||
// rmSync(cloneDir, { recursive: true, force: true });
|
||||
|
||||
if (existsSync(cloneDir)) {
|
||||
process.chdir(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 });
|
||||
if (currentHash !== repo[1]) rmSync(cloneDir, { recursive: true, force: true });*/
|
||||
|
||||
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));
|
||||
|
||||
|
||||
process.chdir(cloneDir);
|
||||
|
||||
const lastHash = await new Promise((res) => exec(`git rev-parse HEAD`, (err, stdout) => res(stdout.trim())));
|
||||
|
||||
await new Promise((res) => exec(`git checkout ${commitHash}`, res));
|
||||
|
||||
const commitTimestamp = await new Promise((res) => exec(`git log -1 --format="%at" | xargs -I{} date -d @{} +%s`, (err, stdout) => res(stdout.trim())));
|
||||
|
||||
if (preprocessor) {
|
||||
const preOut = (await import(`./preprocessors/${preprocessor}.js`)).default(`${cloneDir}${moduleDir}`, repo);
|
||||
|
||||
|
@ -208,6 +212,8 @@ for (const parentRepo of ModuleRepos) {
|
|||
repo: repo[0]
|
||||
},
|
||||
|
||||
lastUpdated: parseInt(commitTimestamp),
|
||||
|
||||
...repo[4]
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue