[object Object]

← back to Dw Fleet Registry

normalize header names → domain name across 53 sites (remove odd brand names like Studio Castel)

8a825a83febf9ed517bf5bc1d3767f891d94722c · 2026-06-01 15:12:13 -0700 · Steve Abrams

Files touched

Diff

commit 8a825a83febf9ed517bf5bc1d3767f891d94722c
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Jun 1 15:12:13 2026 -0700

    normalize header names → domain name across 53 sites (remove odd brand names like Studio Castel)
---
 fix-brand-names.mjs | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/fix-brand-names.mjs b/fix-brand-names.mjs
new file mode 100644
index 0000000..59281e0
--- /dev/null
+++ b/fix-brand-names.mjs
@@ -0,0 +1,44 @@
+#!/usr/bin/env node
+// Replace odd hardcoded header brand names (e.g. "Studio Castel") with the clean
+// DOMAIN-derived name from site.config.json (no .com). Also updates the injected
+// dw-header DwHeaderConfig siteName so the rebuilt header matches. Commits changed
+// sites on the style-rebuild-pilot branch. Idempotent.
+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 targets = fs.readFileSync('/tmp/fleet-targets.txt', 'utf8').split('\n').filter(Boolean);
+const sh = (c, cwd) => { try { return execSync(c, { cwd, stdio: ['ignore','pipe','pipe'] }).toString().trim(); } catch { return null; } };
+const titleCase = s => s.replace(/(wallcoverings?|wallpapers?|walls?|fabric|covering)/gi, ' $1').replace(/\s+/g,' ').trim().replace(/\b\w/g, c => c.toUpperCase());
+
+let changed = 0;
+for (const slug of targets) {
+  const dir = path.join(PROJECTS, slug);
+  const idx = path.join(dir, 'public', 'index.html');
+  if (!fs.existsSync(idx)) continue;
+  // clean name = site.config.json siteName, else titleCased slug
+  let name = titleCase(slug);
+  try { const c = JSON.parse(fs.readFileSync(path.join(dir, 'site.config.json'), 'utf8')); if (c.siteName) name = c.siteName; } catch {}
+  // if config siteName itself is an odd brand (Studio/Atelier/Maison/Casa…), fall back to domain
+  if (/^(studio|atelier|maison|casa|house of|the)\b/i.test(name)) name = titleCase(slug);
+
+  let html = fs.readFileSync(idx, 'utf8');
+  const before = html;
+  const esc = name.replace(/&/g, '&amp;').replace(/</g, '&lt;');
+  // 1) old ns-name span text → clean name
+  html = html.replace(/(<span class="ns-name"[^>]*>)[^<]*(<\/span>)/g, `$1${esc}$2`);
+  // 2) the injected dw-header config siteName → clean name (keep header in sync)
+  html = html.replace(/(window\.DwHeaderConfig=\{siteName:)("[^"]*"|'[^']*')/, `$1${JSON.stringify(name)}`);
+
+  if (html !== before) {
+    fs.writeFileSync(idx, html);
+    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 "header name → domain name '${name}' (remove odd brand name)" && git rev-parse --short HEAD`, dir);
+    changed++;
+    console.log(`  ${slug.padEnd(24)} → "${name}"  ${c || ''}`);
+  }
+}
+console.log(`\n${changed} sites' header names normalized to the domain name`);

← 2df70d0 fleet viewer: make hero drop zone the whole card, not just t  ·  back to Dw Fleet Registry  ·  viewer: hero-pool picker — pick high-res images to rotate pe 706726c →