← back to Dw Fleet Registry

disable-grid.mjs

34 lines

#!/usr/bin/env node
// Disable the hero-4grid overlay on grid sites so the single high-res room/pattern
// hero (hero-bg.jpg) shows full-bleed. Comments ONLY the standalone active script
// line (the inline comment reference on another line is left alone). Commits per site.
//   node disable-grid.mjs   (reads /tmp/fleet-targets.txt)

import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { execSync } from 'node:child_process';

const PROJECTS = path.join(os.homedir(), 'Projects');
const sh = (c, cwd) => { try { return execSync(c, { cwd, stdio: ['ignore','pipe','pipe'] }).toString().trim(); } catch { return null; } };
const targets = fs.readFileSync('/tmp/fleet-targets.txt', 'utf8').split('\n').filter(Boolean);

let done = 0, skipped = 0;
for (const slug of targets) {
  const idx = path.join(PROJECTS, slug, 'public', 'index.html');
  if (!fs.existsSync(idx)) { continue; }
  let html = fs.readFileSync(idx, 'utf8');
  // standalone active script line only (^ anchored, multiline) — leaves inline comment refs alone
  const re = /^(\s*)(<script\s+src="\/hero-4grid\.js"[^>]*><\/script>)\s*$/m;
  if (!re.test(html)) { skipped++; continue; }
  html = html.replace(re, '$1<!-- hero-4grid grid DISABLED so the single high-res hero shows full-bleed --><!-- $2 -->');
  fs.writeFileSync(idx, html);
  const dir = path.join(PROJECTS, slug);
  sh('git checkout -B style-rebuild-pilot', dir);
  sh('git add public/index.html', dir);
  const c = sh('git -c user.email="steve@designerwallcoverings.com" -c user.name="Steve Abrams" commit -q -m "disable hero-4grid overlay so the unique high-res room/pattern hero shows full-bleed" && git rev-parse --short HEAD', dir);
  done++;
  console.log(`${c ? 'DONE ' : 'noop '} ${slug.padEnd(24)} ${c || ''}`);
}
console.log(`\n${done} grids disabled · ${skipped} already single-hero/commented`);