Files
tutti/tools/scripts/verify-renderer-css-contracts.mjs
agent-radar 2ed3415fb7
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00

52 lines
1.5 KiB
JavaScript

#!/usr/bin/env node
import { readdir, readFile } from "node:fs/promises";
import { resolve } from "node:path";
import { analyzeBackdropFilterArtifacts } from "./backdrop-filter-policy.mjs";
const root = resolve(process.argv[2] ?? "apps/desktop/out/renderer/assets");
const paths = await listCssFiles(root);
if (paths.length === 0) {
throw new Error(`No renderer CSS assets found under ${root}`);
}
const assets = await Promise.all(
paths.map(async (path) => ({ path, css: await readFile(path, "utf8") }))
);
const diagnostics = analyzeBackdropFilterArtifacts(assets);
if (diagnostics.length > 0) {
console.error("Renderer CSS backdrop-filter contract failed:");
for (const diagnostic of diagnostics) {
console.error(
`- ${diagnostic.path}:${diagnostic.line}:${diagnostic.column} ${diagnostic.selector ?? ""}: ${diagnostic.message}`
);
}
process.exitCode = 1;
} else {
console.log(`renderer CSS contracts passed (${paths.length} assets)`);
}
async function listCssFiles(directory) {
const entries = await readdir(directory, { withFileTypes: true }).catch(
(error) => {
if (error?.code === "ENOENT") {
return [];
}
throw error;
}
);
const nested = await Promise.all(
entries.map((entry) => {
const path = resolve(directory, entry.name);
if (entry.isDirectory()) {
return listCssFiles(path);
}
return entry.isFile() && entry.name.endsWith(".css") ? [path] : [];
})
);
return nested.flat().sort();
}