diff --git a/scripts/generateClientTypesMap/index.ts b/scripts/generateClientTypesMap/index.ts index ac685b0a8..cb591d2aa 100644 --- a/scripts/generateClientTypesMap/index.ts +++ b/scripts/generateClientTypesMap/index.ts @@ -1,6 +1,7 @@ +import { exec } from "node:child_process"; import { writeFile } from "node:fs/promises"; import { join } from "node:path"; -import { format } from "prettier"; +import { promisify } from "node:util"; import { CLIENT_NAMES, @@ -11,8 +12,7 @@ import { import { getClientReqRespTypesMap } from "./getClientReqRespTypesMap"; import { getClientTypesMap } from "./getClientTypesMap"; -const codegenComment = `// This file is generated by scripts/generateClientTypesMap/index.ts -// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.`; +const execAsync = promisify(exec); (async () => { for (const [mapName, getTypesMap] of [ @@ -22,7 +22,9 @@ const codegenComment = `// This file is generated by scripts/generateClientTypes const filePath = join("src", "transforms", "v2-to-v3", "config", `${mapName}.ts`); const relativeFilePath = join(__dirname, "..", "..", filePath); - let fileContent = codegenComment; + let fileContent = "// This file is generated by scripts/generateClientTypesMap/index.ts\n"; + fileContent += + "// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.\n"; fileContent += "\n\n\n"; fileContent += `export const ${mapName}: Record> = `; @@ -37,11 +39,8 @@ const codegenComment = `// This file is generated by scripts/generateClientTypes } fileContent += JSON.stringify(clientTypesMap); - fileContent += ";\n"; - await writeFile( - relativeFilePath, - await format(fileContent, { parser: "typescript", printWidth: 100 }) - ); + await writeFile(relativeFilePath, fileContent); + await execAsync(`yarn biome format --write ${relativeFilePath}`); } })();