Files
zeekayandHanzo Dev 98338f5c2d point at @luxfi/logo; stop carrying a second copy of the mark
The last change synced the marks in from @luxfi/logo and checked the copy for
drift. That caught the symptom and kept the disease: a mark had two homes, and
the check existed to make two homes behave like one.

So there is one home. This package ships no assets — brand.json names the marks
in @luxfi/logo directly, and @luxfi/logo is a dependency pinned to the exact
version those URLs carry.

The gate no longer diffs bytes; it checks the pointer is honest.

  DRIFT    — a URL names a version other than the one package.json depends on.
             One fact, not two that must be remembered together.
  FLOATING — a URL rides @latest. jsDelivr resolves that alias once and caches it
             for a week, so what a brand renders is decided by a cache nobody
             controls — which is how a fixed logo went on serving the broken one
             for days after it was fixed.
  MISSING  — a named asset is not in the installed package. faviconUrl named a
             .png that never existed here, and nothing noticed.

All three mutation-checked.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-09 10:00:38 -07:00

49 lines
2.2 KiB
JavaScript

// The marks live in @luxfi/logo. This package POINTS at them and carries no copy.
//
// It used to carry one, and that copy was a placeholder for months — a black
// square with the letter L set in a system font. It RENDERED, which is what made
// it invisible: every check asked whether the asset loads, and it did. A synced
// copy with a drift check would have caught that particular failure and left the
// real problem in place, which is that a mark had two homes.
//
// So there is one home. What is checkable here is that the pointer is honest:
//
// 1. every *Url pointing into @luxfi/logo names the version this package
// DEPENDS on — one fact, not two that must be remembered together
// 2. no *Url floats on @latest, which jsDelivr resolves once and caches for a
// week, so what a brand renders is decided by a cache nobody controls
// 3. every named asset actually exists in the installed package
import { readFileSync } from 'node:fs'
import { createRequire } from 'node:module'
import { join, dirname } from 'node:path'
const require = createRequire(import.meta.url)
const pkg = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf8'))
const brand = JSON.parse(readFileSync(join(process.cwd(), 'brand.json'), 'utf8')).brand
const want = pkg.dependencies?.['@luxfi/logo']
// exports maps hide package.json; resolve the entry and walk up.
const logoRoot = join(dirname(require.resolve('@luxfi/logo')), '..')
let failed = 0
const urls = Object.entries(brand).filter(([k, v]) => /Url$/.test(k) && typeof v === 'string')
for (const [field, url] of urls) {
if (/@latest\//.test(url)) {
console.error(`FLOATING: ${field} pins @latest — jsDelivr caches that alias for a week`)
failed++
}
const m = url.match(/\/npm\/@luxfi\/logo@([^/]+)\/(.+)$/)
if (!m) continue
const [, version, rel] = m
if (version !== want) {
console.error(`DRIFT: ${field} names @luxfi/logo@${version}, package.json depends on ${want}`)
failed++
}
try { readFileSync(join(logoRoot, rel)) } catch {
console.error(`MISSING: ${field} names ${rel}, which @luxfi/logo@${want} does not contain`)
failed++
}
}
if (failed) process.exit(1)
console.log(`>> ${urls.length} url(s) pinned to @luxfi/logo@${want}, every asset present`)