Skip to content

Commit

Permalink
build: fix usage of Prettier v3 (#925)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy1339 authored Nov 20, 2023
1 parent c5f266f commit becc4a5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scripts/generate-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ const getEmitterEvents = (): string[] => {

const outDir = "src/generated/";

const generateTypeScriptFile = (name: string, contents: string[]) => {
const generateTypeScriptFile = async (name: string, contents: string[]) => {
fs.writeFileSync(
`${outDir}/${name}.ts`,
format(contents.join("\n"), { parser: "typescript" }),
await format(contents.join("\n"), { parser: "typescript" }),
);
};

Expand All @@ -92,7 +92,7 @@ const asLink = (event: string): string => {
return `[${asCode(event)}](${link})`;
};

const updateReadme = (properties: string[]) => {
const updateReadme = async (properties: string[]) => {
const headers = "| Event | Actions |";

const events = properties.reduce<Record<string, string[]>>(
Expand All @@ -116,7 +116,7 @@ const updateReadme = (properties: string[]) => {
`| ${asLink(event)} | ${actions.map(asCode).join("<br>")} |`,
);

const table = format([headers, "| --- | --- |", ...rows].join("\n"), {
const table = await format([headers, "| --- | --- |", ...rows].join("\n"), {
parser: "markdown",
});

Expand All @@ -141,10 +141,10 @@ const updateReadme = (properties: string[]) => {
);
};

const run = () => {
const run = async () => {
const emitterEvents = getEmitterEvents();

generateTypeScriptFile("webhook-names", [
await generateTypeScriptFile("webhook-names", [
"// THIS FILE IS GENERATED - DO NOT EDIT DIRECTLY",
"// make edits in scripts/generate-types.ts",
"",
Expand All @@ -153,7 +153,7 @@ const run = () => {
"] as const;",
]);

updateReadme(emitterEvents);
await updateReadme(emitterEvents);
};

run();

0 comments on commit becc4a5

Please sign in to comment.