Secondary-dev Next UI with DnD, labels, stopwatch, archive, activity; pads with revisions; README documents pnpm dev:work-api. Co-authored-by: Cursor <cursoragent@cursor.com>
73 lines
2.2 KiB
JavaScript
73 lines
2.2 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Copy Nomadro overlay assets into upstream trees (when present)
|
|
* and apply optional patches under overlay/<service>/patches/*.patch
|
|
*/
|
|
import { spawnSync } from "node:child_process";
|
|
import {
|
|
copyFileSync,
|
|
existsSync,
|
|
mkdirSync,
|
|
readdirSync,
|
|
statSync,
|
|
} from "node:fs";
|
|
import { dirname, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
const overlayRoot = join(root, "overlay");
|
|
const upstreamRoot = join(root, "upstream");
|
|
|
|
function applyPatches(service) {
|
|
const patchDir = join(overlayRoot, service, "patches");
|
|
const dest = join(upstreamRoot, service);
|
|
if (!existsSync(patchDir) || !existsSync(dest)) return;
|
|
const files = readdirSync(patchDir).filter((f) => f.endsWith(".patch"));
|
|
for (const f of files) {
|
|
const p = join(patchDir, f);
|
|
console.log(`[patch] ${service} ← ${f}`);
|
|
const r = spawnSync("git", ["apply", "--whitespace=nowarn", p], {
|
|
cwd: dest,
|
|
stdio: "inherit",
|
|
});
|
|
if (r.status !== 0) {
|
|
console.warn(`[warn] patch failed (maybe already applied): ${f}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
function copySkin(service, fromRel, toRel) {
|
|
const from = join(overlayRoot, service, fromRel);
|
|
const destRoot = join(upstreamRoot, service);
|
|
if (!existsSync(from) || !existsSync(destRoot)) {
|
|
console.log(`[skip] ${service}/${fromRel}`);
|
|
return;
|
|
}
|
|
const to = join(destRoot, toRel);
|
|
mkdirSync(dirname(to), { recursive: true });
|
|
if (statSync(from).isFile()) {
|
|
copyFileSync(from, to);
|
|
console.log(`[copy] ${service}: ${fromRel} → ${toRel}`);
|
|
}
|
|
}
|
|
|
|
if (!existsSync(join(upstreamRoot, "planka"))) {
|
|
console.log(
|
|
"upstream/planka missing — run fetch-upstream.mjs (compose image mode still OK)",
|
|
);
|
|
}
|
|
if (!existsSync(join(upstreamRoot, "etherpad"))) {
|
|
console.log(
|
|
"upstream/etherpad missing — run fetch-upstream.mjs (compose image mode still OK)",
|
|
);
|
|
}
|
|
|
|
copySkin("planka", "nomadro-skin.css", "server/public/nomadro-skin.css");
|
|
copySkin("planka", "nomadro-skin.css", "client/public/nomadro-skin.css");
|
|
copySkin("etherpad", "pad.css", "src/static/custom/pad.css");
|
|
|
|
applyPatches("planka");
|
|
applyPatches("etherpad");
|
|
|
|
console.log("DONE apply-overlay");
|