Shitaye-FrontEnd/scripts/patch-open-next-handler.js
“kirukib” 1a37b91795 feat: soften brand gold, hero copy; OpenNext Cloudflare config
- Replace flat mustard with softer champagne tones and gentler shadows
- Hero eyebrow: Book direct · Shitaye Suite Hotel
- Lighter pattern grid, chips, badges, card hover ring; meetings band ring toned down
- Ignore .dev.vars and .wrangler for local secrets and cache

Made-with: Cursor
2026-03-25 00:18:51 +03:00

42 lines
1.0 KiB
JavaScript

/* eslint-disable no-console */
const fs = require("node:fs");
const path = require("node:path");
function patchIfNeeded(targetPath) {
if (!fs.existsSync(targetPath)) {
console.warn(`[opennext patch] Skip: missing file: ${targetPath}`);
return false;
}
const text = fs.readFileSync(targetPath, "utf8");
const oldStr = "throw new Error(`Unexpected loadManifest(${path2}) call!`)";
const newStr = "return{}";
const count = text.split(oldStr).length - 1;
if (count === 0) {
console.log("[opennext patch] handler already patched (or no-op).");
return false;
}
if (count !== 1) {
console.warn(`[opennext patch] Unexpected match count: ${count}`);
}
const patched = text.replace(oldStr, newStr);
fs.writeFileSync(targetPath, patched, "utf8");
console.log(`[opennext patch] Patched handler loadManifest in ${path.relative(process.cwd(), targetPath)}`);
return true;
}
const target = path.join(
process.cwd(),
".open-next",
"server-functions",
"default",
"handler.mjs",
);
patchIfNeeded(target);