refactor(scripts): cleanup & enforce code style (#1388)
This commit is contained in:
1 parent
7db9b234c1
commit
5d74d700a2
23 files changed
+290
-270
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { UserStylesSchema } from "@/types/mod.ts";
|
||||
import { join } from "@std/path";
|
||||
import { REPO_ROOT } from "@/deps.ts";
|
||||
import type { UserstylesSchema } from "@/types/mod.ts";
|
||||
import { REPO_ROOT } from "@/constants.ts";
|
||||
|
||||
import * as path from "@std/path";
|
||||
import Handlebars from "handlebars";
|
||||
|
||||
// we can have some nice things :)
|
||||
@@ -14,8 +15,8 @@ Handlebars.registerHelper(
|
||||
);
|
||||
|
||||
const heading = (
|
||||
name: UserStylesSchema.Name,
|
||||
link: UserStylesSchema.ApplicationLink,
|
||||
name: UserstylesSchema.Name,
|
||||
link: UserstylesSchema.ApplicationLink,
|
||||
) => {
|
||||
const [nameArray, linkArray] = [[name].flat(), [link].flat()];
|
||||
|
||||
@@ -30,11 +31,11 @@ const heading = (
|
||||
});
|
||||
};
|
||||
|
||||
const extractName = (
|
||||
function extractName(
|
||||
collaborators?:
|
||||
| UserStylesSchema.CurrentMaintainers
|
||||
| UserStylesSchema.PastMaintainers,
|
||||
) => {
|
||||
| UserstylesSchema.CurrentMaintainers
|
||||
| UserstylesSchema.PastMaintainers,
|
||||
) {
|
||||
// no-op when undefined
|
||||
if (!collaborators) return;
|
||||
// set the name to the github.com/<name>
|
||||
@@ -42,12 +43,10 @@ const extractName = (
|
||||
c.name ??= c.url.split("/").pop();
|
||||
return c;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export const generateStyleReadmes = (
|
||||
userstyles: UserStylesSchema.Userstyles,
|
||||
) => {
|
||||
const stylesReadmePath = join(
|
||||
export function generateStyleReadmes(userstyles: UserstylesSchema.Userstyles) {
|
||||
const stylesReadmePath = path.join(
|
||||
REPO_ROOT,
|
||||
"scripts/generate/templates/userstyle.md",
|
||||
);
|
||||
@@ -77,9 +76,9 @@ export const generateStyleReadmes = (
|
||||
},
|
||||
});
|
||||
Deno.writeTextFile(
|
||||
join(REPO_ROOT, "styles", slug.toString(), "README.md"),
|
||||
path.join(REPO_ROOT, "styles", slug.toString(), "README.md"),
|
||||
readmeContent,
|
||||
).catch((e) => console.error(e));
|
||||
},
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user