mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-03 17:23:56 +08:00
update 2026-10-13 23:30:23
This commit is contained in:
1 parent
09818a2882
commit
1e69cad46b
710 files changed
+368
-159536
No files matched your search
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2025 eamonxg <eamonxiong@gmail.com>
|
||||
* Licensed under the Apache License, Version 2.0.
|
||||
*/
|
||||
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
const outputDir = resolve(
|
||||
import.meta.dirname,
|
||||
"../../htdocs/luci-static/shadcn",
|
||||
);
|
||||
const files = ["main.css", "login.css"];
|
||||
const forbidden = [
|
||||
{
|
||||
label: "token-based color-mix()",
|
||||
pattern: /color-mix\([^)]*var\(--/g,
|
||||
},
|
||||
{
|
||||
label: "relative oklch()",
|
||||
pattern: /oklch\(from/g,
|
||||
},
|
||||
];
|
||||
const failures = [];
|
||||
|
||||
for (const file of files) {
|
||||
const css = await readFile(resolve(outputDir, file), "utf8");
|
||||
|
||||
for (const { label, pattern } of forbidden) {
|
||||
const count = css.match(pattern)?.length ?? 0;
|
||||
if (count > 0) failures.push(`${file}: ${label} × ${count}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (failures.length > 0) {
|
||||
console.error(`Runtime token color functions found:\n${failures.join("\n")}`);
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log("Built CSS contains no runtime token color functions.");
|
||||
}
|
||||
Reference in new issue
Block a user