nomadro/apps/notify/scripts/fetch-upstream.mjs
Eric ffa456afdf Ship social join profile + SeaweedFS avatars, notify/coffee, and .com audience stack.
Pay-then-profile join desk with live card, S3 upload fallback, hydration-safe drafts; document on test9 README.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-04 02:25:05 +08:00

50 lines
1.3 KiB
JavaScript

#!/usr/bin/env node
/**
* Shallow-clone Novu into apps/notify/upstream/ for secondary development.
* Does not commit upstream into git.
*/
import { spawnSync } from "node:child_process";
import { existsSync, mkdirSync, rmSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
const upstream = join(root, "upstream");
const REPOS = [
{
name: "novu",
url: "https://github.com/novuhq/novu.git",
branch: "next",
},
];
mkdirSync(upstream, { recursive: true });
function run(cmd, args, cwd) {
console.log(`$ ${cmd} ${args.join(" ")}`);
const r = spawnSync(cmd, args, { cwd, stdio: "inherit", shell: false });
if (r.status !== 0) process.exit(r.status || 1);
}
for (const repo of REPOS) {
const dest = join(upstream, repo.name);
if (existsSync(join(dest, ".git"))) {
console.log(`[skip] ${repo.name} already cloned — pull --ff-only`);
run("git", ["-C", dest, "pull", "--ff-only", "origin", repo.branch]);
continue;
}
if (existsSync(dest)) rmSync(dest, { recursive: true, force: true });
run("git", [
"clone",
"--depth",
"1",
"--branch",
repo.branch,
repo.url,
dest,
]);
}
console.log("DONE fetch-upstream →", upstream);