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

+2 -2
View File
@@ -1,9 +1,9 @@
import { join } from "std/path/mod.ts";
import { join } from "@std/path";
import { REPO_ROOT } from "@/deps.ts";
import { updateFile } from "@/generate/utils.ts";
import { UserStylesSchema } from "@/types/mod.ts";
import { stringify } from "std/yaml/stringify.ts";
import { stringify } from "@std/yaml";
import { type ColorName, flavors } from "@catppuccin/palette";
/**
+2 -2
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env -S deno run -A
import { join } from "std/path/mod.ts";
import { join } from "@std/path";
import { portsSchema, REPO_ROOT, userStylesSchema } from "@/deps.ts";
import type { PortsSchema, UserStylesSchema } from "@/types/mod.ts";
@@ -53,7 +53,7 @@ await syncIssueLabels(userstylesData.userstyles);
* Keep `.github/CODEOWNERS` in sync with the userstyle metadata.
*/
const maintainersCodeOwners = () => {
return Object.entries(userstylesData.userstyles)
return Object.entries(userstylesData.userstyles!)
.filter(([_, { "current-maintainers": currentMaintainers }]) =>
currentMaintainers.length > 0
)
+10 -8
View File
@@ -1,4 +1,4 @@
import { join } from "std/path/mod.ts";
import { join } from "@std/path";
import Handlebars from "handlebars";
import { REPO_ROOT } from "@/deps.ts";
@@ -52,13 +52,15 @@ export const generateMainReadme = async (
return {
emoji: meta.emoji,
name: meta.name,
ports: ports.map(({ name, path, "current-maintainers": currentMaintainers }) => {
return {
name: [name].flat(),
maintained: currentMaintainers.length > 0,
path,
};
}),
ports: ports.map(
({ name, path, "current-maintainers": currentMaintainers }) => {
return {
name: [name].flat(),
maintained: currentMaintainers.length > 0,
path,
};
},
),
};
}),
});
+30 -18
View File
@@ -1,5 +1,5 @@
import { UserStylesSchema } from "@/types/mod.ts";
import { join } from "std/path/mod.ts";
import { join } from "@std/path";
import { REPO_ROOT } from "@/deps.ts";
import Handlebars from "handlebars";
@@ -53,21 +53,33 @@ export const generateStyleReadmes = (
);
const stylesReadmeContent = Deno.readTextFileSync(stylesReadmePath);
Object.entries(userstyles).map(([slug, { name, readme, "current-maintainers": currentMaintainers, "past-maintainers": pastMaintainers }]) => {
console.log(`Generating README for ${slug}`);
const readmeContent = Handlebars.compile(stylesReadmeContent)({
heading: heading(name, readme["app-link"]),
slug,
usage: readme.usage,
faq: readme.faq,
collaborators: {
currentMaintainers: extractName(currentMaintainers),
pastMaintainers: extractName(pastMaintainers),
},
});
Deno.writeTextFile(
join(REPO_ROOT, "styles", slug.toString(), "README.md"),
readmeContent,
).catch((e) => console.error(e));
});
Object.entries(userstyles).map(
(
[
slug,
{
name,
readme,
"current-maintainers": currentMaintainers,
"past-maintainers": pastMaintainers,
},
],
) => {
console.log(`Generating README for ${slug}`);
const readmeContent = Handlebars.compile(stylesReadmeContent)({
heading: heading(name, readme["app-link"]),
slug,
usage: readme.usage,
faq: readme.faq,
collaborators: {
currentMaintainers: extractName(currentMaintainers),
pastMaintainers: extractName(pastMaintainers),
},
});
Deno.writeTextFile(
join(REPO_ROOT, "styles", slug.toString(), "README.md"),
readmeContent,
).catch((e) => console.error(e));
},
);
};