refactor(scripts): use deno's std on jsr (#1091)

This commit is contained in:
uncenter authored and GitHub committed 2024-07-19 14:58:14 -04:00
1 parent 89c3e2a7ef
commit a801279ae1
18 files changed
+178 -290

No files matched your search

+8 -8
View File
@@ -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
);
}