Added cloning and CLI downloading scripts.
This commit is contained in:
commit
0fe1873950
4 files changed
+151
No files matched your search
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env node
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { existsSync } from "node:fs";
|
||||
import { mkdir, readFile } from "node:fs/promises";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const org = "storytold";
|
||||
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
||||
const config = JSON.parse(await readFile(join(scriptDir, "config.json"), "utf8"));
|
||||
const upstream = join(scriptDir, "upstream");
|
||||
|
||||
await mkdir(upstream, { recursive: true });
|
||||
|
||||
let failed = 0;
|
||||
for (const app of config.repos) {
|
||||
const dir = join(upstream, app);
|
||||
const args = existsSync(dir)
|
||||
? ["-C", dir, "fetch", "origin", "--tags"]
|
||||
: ["clone", `https://github.com/${org}/${app}`, dir];
|
||||
try {
|
||||
execFileSync("git", args, { stdio: "inherit" });
|
||||
} catch {
|
||||
failed++;
|
||||
console.error(`${app}: git ${args[0] === "-C" ? "fetch" : "clone"} failed`);
|
||||
}
|
||||
}
|
||||
process.exit(failed ? 1 : 0);
|
||||
Reference in new issue
Block a user