diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/fetcher/index.js | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/includes/fetcher/index.js b/includes/fetcher/index.js index 43357c8..631a5e1 100644 --- a/includes/fetcher/index.js +++ b/includes/fetcher/index.js @@ -223,24 +223,28 @@ } }).filter(i => i !== null), null, 4)); - if (fs.existsSync("personal")) fs.rmSync("personal", { recursive: true }) - console.log("Cloning minteck/minteck from GitHub..."); - cp.execSync("git clone https://github.com/minteck/minteck personal"); - let list = []; - for (let project of require('./projects.json')) { - if (!project.archive) { - list.push(project.name + " | [" + project.path + "](https://gitlab.minteck.org/" + project.path + ")"); + try { + if (fs.existsSync("personal")) fs.rmSync("personal", { recursive: true }) + console.log("Cloning minteck/minteck from GitHub..."); + cp.execSync("git clone https://github.com/minteck/minteck personal"); + let list = []; + for (let project of require('./projects.json')) { + if (!project.archive) { + list.push(project.name + " | [" + project.path + "](https://gitlab.minteck.org/" + project.path + ")"); + } } - } - for (let project of require('./projects.json')) { - if (project.archive) { - list.push("*" + project.name + "* | *[" + project.path + "](https://gitlab.minteck.org/" + project.path + ")*"); + for (let project of require('./projects.json')) { + if (project.archive) { + list.push("*" + project.name + "* | *[" + project.path + "](https://gitlab.minteck.org/" + project.path + ")*"); + } } + console.log("Saving..."); + fs.writeFileSync("./personal/README.md", "<!-- WARNING: Do not modify this file, modify README.mdt instead. This file will get overwritten whenever the project fetcher runs. -->\n" + fs.readFileSync("./personal/README.mdt").toString().replace("%GITLABFILLHERE%", list.join("\n"))); + console.log("Publishing changes to GitHub..."); + cp.execSync("git add -A", { cwd: "personal" }); + cp.execSync("git commit -m \"Update: " + new Date().toISOString() + "\"", { cwd: "personal" }); + cp.execSync("git push origin main", { cwd: "personal" }); + } catch (e) { + console.error(e); } - console.log("Saving..."); - fs.writeFileSync("./personal/README.md", "<!-- WARNING: Do not modify this file, modify README.mdt instead. This file will get overwritten whenever the project fetcher runs. -->\n" + fs.readFileSync("./personal/README.mdt").toString().replace("%GITLABFILLHERE%", list.join("\n"))); - console.log("Publishing changes to GitHub..."); - cp.execSync("git add -A", { cwd: "personal" }); - cp.execSync("git commit -m \"Update: " + new Date().toISOString() + "\"", { cwd: "personal" }); - cp.execSync("git push origin main", { cwd: "personal" }); })()
\ No newline at end of file |