From 757445df0a79b338161b5ace56ea9b74281c5154 Mon Sep 17 00:00:00 2001 From: nullishamy Date: Thu, 28 Mar 2024 20:21:01 +0000 Subject: [PATCH] ci: fix path bugs on windows (#726) --- scripts/deps.ts | 7 ++++++- scripts/lint/metadata.ts | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/deps.ts b/scripts/deps.ts index 0629c531..d7504204 100644 --- a/scripts/deps.ts +++ b/scripts/deps.ts @@ -6,7 +6,12 @@ import userStylesSchema from "@/userstyles.schema.json" with { }; import { join } from "std/path/mod.ts"; -const ROOT = new URL(".", import.meta.url).pathname; + +const ROOT = import.meta.dirname; +if (!ROOT) { + throw new Error("ROOT was not located."); +} + /** * absolute path to the repository */ diff --git a/scripts/lint/metadata.ts b/scripts/lint/metadata.ts index 30df942b..dad85d23 100644 --- a/scripts/lint/metadata.ts +++ b/scripts/lint/metadata.ts @@ -16,6 +16,9 @@ export const verifyMetadata = async ( userstyle: string, userstyles: Userstyles, ) => { + // `usercss-meta` prohibits any '\r' characters, which seem to be present on Windows. + content = content.replaceAll("\r\n", "\n"); + const assert = assertions(userstyle, userstyles); const file = relative(REPO_ROOT, entry.path);