// 把 tools/font-assets.json 合并进 public/cockpit/assets/manifest.json 的 fonts 块。 // 幂等:反复运行结果一致;不改动既有 entries(图标)与 release 之外的任何字段。 // 用法:node scripts/merge-font-assets.mjs import { readFileSync, writeFileSync } from 'node:fs' import { join, dirname } from 'node:path' import { fileURLToPath } from 'node:url' const here = dirname(fileURLToPath(import.meta.url)) const ROOT = join(here, '..', '..', '..') const manifestPath = join(ROOT, 'public', 'cockpit', 'assets', 'manifest.json') const built = JSON.parse(readFileSync(join(here, 'font-assets.json'), 'utf8')) const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) manifest.fonts = { note: '字体授权门禁的事实来源(规格 11):entries 里的字体条目必须命中 licenses 里「证据齐全」的一条,否则解析阶段不可用、走系统回退。', subsetTextChars: built.subsetTextChars, licenses: built.licenses, entries: built.entries, } writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n', 'utf8') console.log('merged fonts block:', built.licenses.length, 'licenses /', built.entries.length, 'entries', '| release:', manifest.release)