forked from RhysSullivan/executor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull-references.ts
More file actions
30 lines (26 loc) · 950 Bytes
/
pull-references.ts
File metadata and controls
30 lines (26 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { existsSync } from "node:fs";
import { mkdir } from "node:fs/promises";
import { join } from "node:path";
import { $ } from "bun";
const REFERENCE_DIR = join(import.meta.dirname, "../.reference");
const repos = [
{ name: "effect", url: "https://github.com/Effect-TS/effect.git" },
{ name: "effect-atom", url: "https://github.com/tim-smart/effect-atom.git" },
{ name: "executor", url: "https://github.com/RhysSullivan/executor.git" },
{
name: "tanstack-router",
url: "https://github.com/TanStack/router.git",
},
];
await mkdir(REFERENCE_DIR, { recursive: true });
for (const repo of repos) {
const dest = join(REFERENCE_DIR, repo.name);
if (existsSync(dest)) {
console.log(`Pulling ${repo.name}...`);
await $`git -C ${dest} pull --ff-only`.quiet();
} else {
console.log(`Cloning ${repo.name}...`);
await $`git clone --depth 1 ${repo.url} ${dest}`.quiet();
}
console.log(` ✓ ${repo.name}`);
}