mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Signed-off-by: Wes <wesbillman@users.noreply.github.com> Co-authored-by: Pinky <44b8e82baa6e0e254e0208d68f335c283c94e7b78dd1fa10d5a49d3f13dd0435@sprout-oss.stage.blox.sqprod.co>
40 lines
1.6 KiB
JavaScript
40 lines
1.6 KiB
JavaScript
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { runPxTextCheck } from "../../scripts/check-px-text-core.mjs";
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const projectRoot = path.resolve(__dirname, "..");
|
|
|
|
// Enforces the rem-token text scale app-wide. The rem→px zoom regression
|
|
// (PR #891) landed in the message-timeline render path, but arbitrary text
|
|
// literals (`text-[…px]`, `text-[…rem]`) had drifted across the whole desktop
|
|
// app — so the guard now scans all of `src`. Readable text MUST use a rem-based
|
|
// token (the stock `text-base`/`text-sm`/`text-xs` scale, or the `text-2xs` /
|
|
// `text-3xs` meta-text tokens) so Cmd +/- zoom scales it and the size stays on
|
|
// one consolidated scale. Genuine decorative glyphs are allowlisted below.
|
|
const rules = [
|
|
{
|
|
root: "src",
|
|
extensions: new Set([".ts", ".tsx", ".css"]),
|
|
},
|
|
];
|
|
|
|
// Decorative / chrome exceptions: `relativePath:matchedLiteral`. The avatar
|
|
// emoji glyphs are fixed display sizes sized to their avatar box (not readable
|
|
// message text), so they are exempted from the readable-text px rule. Matching
|
|
// the literal keeps these exceptions stable when unrelated edits move lines.
|
|
const overrides = new Set([
|
|
"src/features/settings/ui/ProfileSettingsCard.tsx:text-[6rem]",
|
|
"src/features/onboarding/ui/AvatarStep.tsx:text-[6rem]",
|
|
"src/features/agents/ui/AgentCreationPreview.tsx:text-[4rem]",
|
|
"src/features/agents/ui/AgentCreationPreview.tsx:text-[6rem]",
|
|
]);
|
|
|
|
await runPxTextCheck({
|
|
projectRoot,
|
|
rules,
|
|
overrides,
|
|
label: "Desktop",
|
|
scriptPath: "desktop/scripts/check-px-text.mjs",
|
|
});
|