fix(lib,scripts): import locally for linting, snapshot tests, dev server (#2172)

Co-authored-by: WalkQuackBack <[email protected]>
This commit is contained in:
uncenterandWalkQuackBack authored and GitHub committed 2026-04-25 21:35:37 -05:00
1 parent dc1fac9639
commit acd47ee987
8 files changed
+302 -18

No files matched your search

+15 -3
View File
@@ -24,12 +24,19 @@ const stylesheets = userstyle
const { userstyles } = getUserstylesData();
let didLintFail = false;
const patches = [
["https://userstyles.catppuccin.com/lib", path.join(REPO_ROOT, "lib")],
];
for (const style of stylesheets) {
const dir = path.basename(path.dirname(style));
const file = path.relative(REPO_ROOT, style);
let content = await Deno.readTextFile(style);
// Apply patches.
for (const [search, replace] of patches) {
content = content.replaceAll(search, replace);
}
// Verify the UserCSS metadata.
const { globalVars, isLess, fixed } = await verifyMetadata(
@@ -56,10 +63,15 @@ for (const style of stylesheets) {
},
);
// Reverse apply patches.
for (const [search, replace] of patches) {
content = content.replaceAll(replace, search);
}
// Lint with Stylelint.
await runStylelint(style, content, args.fix, stylelintConfig).catch(() =>
didLintFail = true
);
const results = await runStylelint(style, content, args.fix, stylelintConfig)
.catch(() => didLintFail = true);
Deno.writeTextFileSync(file, typeof results === "string" ? results : content);
}
if (await checkForMissingFiles() === false) didLintFail = true;