refactor(scripts): use deno's std on jsr (#1091)
This commit is contained in:
1 parent
89c3e2a7ef
commit
a801279ae1
18 files changed
+178
-290
No files matched your search
@@ -1,10 +1,10 @@
|
||||
import { exists } from "std/fs/exists.ts";
|
||||
import { join, relative } from "std/path/mod.ts";
|
||||
import { exists } from "@std/fs";
|
||||
import { join, relative } from "@std/path";
|
||||
import core from "@actions/core";
|
||||
|
||||
import { REPO_ROOT } from "@/deps.ts";
|
||||
import { log } from "@/lint/logger.ts";
|
||||
import * as color from "std/fmt/colors.ts";
|
||||
import * as color from "@std/fmt/colors";
|
||||
|
||||
const requiredFiles = [
|
||||
"catppuccin.user.css",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sprintf } from "std/fmt/printf.ts";
|
||||
import * as color from "std/fmt/colors.ts";
|
||||
import { sprintf } from "@std/fmt/printf";
|
||||
import * as color from "@std/fmt/colors";
|
||||
import core from "@actions/core";
|
||||
|
||||
export type LoggerProps = core.AnnotationProperties & { content?: string };
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env -S deno run -A
|
||||
import { walk } from "std/fs/walk.ts";
|
||||
import { parse as parseFlags } from "std/flags/mod.ts";
|
||||
import { basename, dirname, join, relative } from "std/path/mod.ts";
|
||||
// @deno-types="npm:@types/less";
|
||||
import { walk } from "@std/fs";
|
||||
import { parseArgs } from "@std/cli";
|
||||
import { basename, dirname, join, relative } from "@std/path";
|
||||
// @ts-types="npm:@types/less";
|
||||
import less from "less";
|
||||
|
||||
import { REPO_ROOT } from "@/deps.ts";
|
||||
@@ -13,8 +13,8 @@ import { lint } from "@/lint/stylelint.ts";
|
||||
import { getUserstylesData } from "@/utils.ts";
|
||||
import stylelintConfig from "../../.stylelintrc.js";
|
||||
|
||||
const flags = parseFlags(Deno.args, { boolean: ["fix"] });
|
||||
const subDir = flags._[0]?.toString() ?? "";
|
||||
const args = parseArgs(Deno.args, { boolean: ["fix"] });
|
||||
const subDir = args._[0]?.toString() ?? "";
|
||||
const stylesheets = walk(join(REPO_ROOT, "styles", subDir), {
|
||||
includeFiles: true,
|
||||
includeDirs: false,
|
||||
@@ -37,7 +37,7 @@ for await (const entry of stylesheets) {
|
||||
content,
|
||||
dir,
|
||||
userstyles,
|
||||
flags.fix,
|
||||
args.fix,
|
||||
);
|
||||
|
||||
content = fixed;
|
||||
@@ -58,7 +58,7 @@ for await (const entry of stylesheets) {
|
||||
);
|
||||
|
||||
// Lint with Stylelint.
|
||||
await lint(entry, content, flags.fix, stylelintConfig).catch(() =>
|
||||
await lint(entry, content, args.fix, stylelintConfig).catch(() =>
|
||||
failed = true
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// @deno-types="@/types/usercss-meta.d.ts";
|
||||
// @ts-types="@/types/usercss-meta.d.ts";
|
||||
import usercssMeta from "usercss-meta";
|
||||
import * as color from "std/fmt/colors.ts";
|
||||
import { sprintf } from "std/fmt/printf.ts";
|
||||
import type { WalkEntry } from "std/fs/walk.ts";
|
||||
import { join, relative } from "std/path/mod.ts";
|
||||
import * as color from "@std/fmt/colors";
|
||||
import { sprintf } from "@std/fmt/printf";
|
||||
import type { WalkEntry } from "@std/fs";
|
||||
import { join, relative } from "@std/path";
|
||||
|
||||
import { REPO_ROOT } from "@/deps.ts";
|
||||
import { log } from "@/lint/logger.ts";
|
||||
@@ -47,7 +47,10 @@ export const verifyMetadata = async (
|
||||
.findIndex((line) => line.includes(key)) + 1;
|
||||
|
||||
const message = current === undefined
|
||||
? sprintf("Metadata `%s` should not be undefined", color.bold(key))
|
||||
? sprintf(
|
||||
"Metadata `%s` should not be undefined",
|
||||
color.bold(key),
|
||||
)
|
||||
: sprintf(
|
||||
'Metadata `%s` should be "%s" but is "%s"',
|
||||
color.bold(key),
|
||||
@@ -63,9 +66,10 @@ export const verifyMetadata = async (
|
||||
}
|
||||
}
|
||||
|
||||
const template =
|
||||
(await Deno.readTextFile(join(REPO_ROOT, "template/catppuccin.user.css")))
|
||||
.split("\n");
|
||||
const template = (await Deno.readTextFile(
|
||||
join(REPO_ROOT, "template/catppuccin.user.css"),
|
||||
))
|
||||
.split("\n");
|
||||
|
||||
for (const variable of ["darkFlavor", "lightFlavor", "accentColor"]) {
|
||||
const declaration = `@var select ${variable}`;
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ const ruleFunction = (primary, _secondary, context) => {
|
||||
"mergePaths",
|
||||
"removeComments",
|
||||
"removeUselessDefs",
|
||||
"removeScriptElement"
|
||||
"removeScriptElement",
|
||||
],
|
||||
}).data;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as color from "std/fmt/colors.ts";
|
||||
import type { WalkEntry } from "std/fs/walk.ts";
|
||||
import { relative } from "std/path/mod.ts";
|
||||
import * as color from "@std/fmt/colors";
|
||||
import type { WalkEntry } from "@std/fs";
|
||||
import { relative } from "@std/path";
|
||||
|
||||
import "postcss-less";
|
||||
import stylelint from "stylelint";
|
||||
|
||||
Reference in new issue
Block a user