新增通用 CSS 到 OOXML 翻译修复,统一字体、字距、精确行距、段落、列表、表格、引用、代码块与行内代码连续性,不引入按主题 ID 分支。 新增 MdTP Mono 并统一 Serif、Sans、Mono 三字体包的 Chromium 与 DOCX 使用链;字体声明、嵌入部件和 Word/WPS 实际采用均进入硬门禁。 重建封面整页及正文语义块视觉差分,14 套主题、纵横两个方向、五组页边距共 140 个真实场景全部通过,阻断失败和诊断失败均为零。 源码服务、Docker Web API 与实际安装 Desktop 的 red-briefing 导出均包含 5 个字体部件;Word/WPS 原生渲染和逐页复核通过。修复 Docker 构建上下文与运行层复用软链接,并完善 v0.6.1 版本、发行说明和发布归集。 验证:npm test(116 个文件、616 项测试)、npm run typecheck、npm run build、git diff --check 全部通过。Desktop 安装器与 ZIP、Docker v0.6.1 镜像已生成;Windows 产物仍为未签名内部发行。
76 lines
2.4 KiB
JavaScript
76 lines
2.4 KiB
JavaScript
import { readFile } from "node:fs/promises";
|
||
import { dirname, join, resolve } from "node:path";
|
||
import { fileURLToPath } from "node:url";
|
||
import {
|
||
buildFontPack,
|
||
verifyFontPack
|
||
} from "../packages/font-pack-builder/dist/index.js";
|
||
import { discoverFontPacks } from "../packages/font-pack-registry/dist/index.js";
|
||
|
||
const repositoryRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||
const bundlePath = join(repositoryRoot, "font-packs", "bundle.json");
|
||
const bundle = JSON.parse(await readFile(bundlePath, "utf8"));
|
||
const outputRoot = join(repositoryRoot, "output", "font-packs", "root");
|
||
const appVersion = process.env.npm_package_version || "0.6.1";
|
||
|
||
if (
|
||
bundle.schemaVersion !== 1 ||
|
||
!Array.isArray(bundle.packs) ||
|
||
bundle.packs.length === 0
|
||
) {
|
||
throw new Error("字体包集合清单无效");
|
||
}
|
||
|
||
const identities = new Set();
|
||
const reports = [];
|
||
for (const pack of bundle.packs) {
|
||
const identity = `${pack.id}@${pack.version}`;
|
||
if (identities.has(identity)) {
|
||
throw new Error(`字体包集合存在重复项:${identity}`);
|
||
}
|
||
identities.add(identity);
|
||
const reportPath = join(
|
||
repositoryRoot,
|
||
"output",
|
||
"font-packs",
|
||
`${pack.id}-build-report.json`
|
||
);
|
||
const built = await buildFontPack({
|
||
recipePath: resolve(repositoryRoot, pack.recipe),
|
||
sourceRoot: resolve(repositoryRoot, pack.sourceRoot),
|
||
outputRoot,
|
||
reportPath
|
||
});
|
||
const verified = await verifyFontPack({
|
||
root: outputRoot,
|
||
appVersion,
|
||
packId: pack.id,
|
||
packVersion: pack.version
|
||
});
|
||
reports.push({ identity, built, verified });
|
||
}
|
||
|
||
const registry = await discoverFontPacks({
|
||
roots: [outputRoot],
|
||
appVersion
|
||
});
|
||
const errors = registry.diagnostics.filter((item) => item.severity === "error");
|
||
if (errors.length > 0) {
|
||
throw new Error(
|
||
`字体包集合注册失败:${errors.map((item) => `${item.code} ${item.message}`).join(";")}`
|
||
);
|
||
}
|
||
const actualIdentities = registry.packs
|
||
.map((pack) => `${pack.id}@${pack.version}`)
|
||
.sort();
|
||
const expectedIdentities = [...identities].sort();
|
||
if (JSON.stringify(actualIdentities) !== JSON.stringify(expectedIdentities)) {
|
||
throw new Error(
|
||
`字体包输出根目录包含清单外内容:期望 ${expectedIdentities.join(", ")},实际 ${actualIdentities.join(", ")}`
|
||
);
|
||
}
|
||
|
||
process.stdout.write(
|
||
`${JSON.stringify({ appVersion, outputRoot, registryFingerprint: registry.fingerprint, reports }, null, 2)}\n`
|
||
);
|