Files
Reims-Go/frontend/scripts/test-brand.mjs
T
千川白浪 f4395a1f28 refactor(brand): generate the frontend logo copy and wordmark geometry
assets/logo.svg was duplicated byte for byte in frontend/public, and WordmarkLoader hand-copied the ten wordmark strokes from the Python generator, so the icon and the lettering could drift silently.

scripts/brand/wordmark.py now writes frontend/public/logo.svg and frontend/src/components/wordmark.gen.ts, and the loader imports that geometry. The unreferenced assets/wordmark-*.svg outputs are gone, and frontend/scripts/test-brand.mjs fails when either copy is edited by hand.
2026-12-04 23:24:36 -07:00

22 lines
1.1 KiB
JavaScript

// scripts/brand/wordmark.py is the single source of the icon and the wordmark
// geometry: it copies assets/logo.svg into public/ and generates
// wordmark.gen.ts. Neither copy may be edited by hand.
import test from 'node:test'
import assert from 'node:assert/strict'
import fs from 'node:fs'
import path from 'node:path'
const repoRoot = path.resolve(import.meta.dirname, '..', '..')
test('frontend/public/logo.svg is the copy of assets/logo.svg', () => {
const source = fs.readFileSync(path.join(repoRoot, 'assets', 'logo.svg'))
const served = fs.readFileSync(path.join(repoRoot, 'frontend', 'public', 'logo.svg'))
assert.ok(source.equals(served), 'run python scripts/brand/wordmark.py to refresh frontend/public/logo.svg')
})
test('the frontend wordmark geometry is generated', () => {
const generated = fs.readFileSync(path.join(repoRoot, 'frontend', 'src', 'components', 'wordmark.gen.ts'), 'utf8')
assert.match(generated, /^\/\/ Code generated by scripts\/brand\/wordmark\.py; DO NOT EDIT\./)
assert.match(generated, /export const WORDMARK_STROKES: WordmarkStroke\[\] = \[/)
})