refactor: consolidate color definitions into single source of truth

- Create frontend/colors.mjs as SSOT for all design colors
- Create scripts/generate-css-vars.mjs to auto-generate CSS variables
- Update tailwind.config.ts to import colors from colors.mjs
- Update frontend/package.json: add 'generate-css-vars' script to build pipeline
- Update start_servers.py: include CSS variable generation before npm build
- All color changes now require only one edit in colors.mjs
- Build process auto-syncs CSS variables and Tailwind colors

Eliminates DRY violation where colors were duplicated in:
  - tailwind.config.ts (Tailwind utility classes)
  - globals.css (CSS custom properties)

Single source of truth approach ensures:
  ✓ No inconsistency between Tailwind and CSS variables
  ✓ One place to update colors for all contexts
  ✓ Automated CSS variable generation on every build

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 17:31:25 +03:00
parent de1708a754
commit e715afd814
11 changed files with 281 additions and 264 deletions

View File

@@ -168,6 +168,16 @@ class StandaloneServerManager:
)
if not (frontend_dir / ".next" / "standalone").exists():
# Generate CSS variables from colors.mjs before building
self.log("Generating CSS variables from design system...")
result = subprocess.run(
["node", "scripts/generate-css-vars.mjs"],
cwd=str(frontend_dir),
capture_output=True
)
if result.returncode != 0:
self.log(f"⚠ CSS variable generation warning: {result.stderr.decode()}")
self.log("Building Next.js application...")
result = subprocess.run(
["npm", "run", "build"],