chore: remove less migration stub script and files

This commit is contained in:
uncenter committed 2025-03-25 09:29:28 -04:00
1 parent d724bd106a
commit 043aa217af
117 files changed
-1951

No files matched your search

-65
View File
@@ -1,65 +0,0 @@
import { getUserstylesFiles } from "@/utils.ts";
import { relative } from "@std/path";
import { REPO_ROOT } from "@/constants.ts";
const METADATA_ENDING_COMMENT = "==/UserStyle== */";
for (const userstyle of getUserstylesFiles()) {
const content = Deno.readTextFileSync(userstyle);
const start = content.indexOf(METADATA_ENDING_COMMENT);
if (start === -1) {
throw new Error("Userstyle metadata ending comment not found");
}
const metadata = content.slice(0, start + METADATA_ENDING_COMMENT.length);
const oldPath = userstyle.replace(/\.less$/, ".css");
const relativeOldPath = relative(REPO_ROOT, oldPath);
const relativeNewPath = relative(REPO_ROOT, userstyle);
const updateURLPrefix =
"@updateURL https://github.com/catppuccin/userstyles/raw/main/";
let newContent = metadata.replace(
updateURLPrefix + relativeOldPath,
updateURLPrefix + relativeNewPath,
);
const newContentLines = newContent.split("\n");
const nameVarLine = newContentLines.findIndex((line) =>
line.startsWith("@name")
);
if (nameVarLine === -1) {
throw new Error("Userstyle name variable not found");
}
newContentLines[nameVarLine] += " [STUB | UPDATE REQUIRED]";
newContent = newContentLines.join("\n");
Deno.writeTextFileSync(
userstyle.replace(/\.less$/, ".css"),
newContent,
);
// Bump once for update to stub.
execBumpTask(relativeOldPath);
// Bump twice so that version is higher than stub.
execBumpTask(relativeNewPath);
execBumpTask(relativeNewPath);
}
async function execBumpTask(file: string) {
const bumpTask = new Deno.Command(
Deno.execPath(),
{
args: [
"task",
"bump",
file,
],
},
);
const output = await bumpTask.output();
if (output.success === false) {
throw new Error(new TextDecoder().decode(output.stderr));
}
}