From c0dec465a5bb4069ab629bae9607f1da9aca5868 Mon Sep 17 00:00:00 2001 From: Felix Weinberger Date: Thu, 26 Mar 2026 18:14:05 +0000 Subject: [PATCH] ci: format fetch-spec-types output with prettier The nightly update-spec-types workflow is failing because lefthook's pre-push hook (added in #1003) runs `pnpm run lint:all`, which rejects the freshly-fetched spec.types.ts for not matching prettier style. Format the output via prettier's Node API using the project config before writing it to disk. This also reduces nightly PR diffs to only semantic changes, not formatting noise. --- scripts/fetch-spec-types.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/fetch-spec-types.ts b/scripts/fetch-spec-types.ts index e88902d67..cd0e26f5f 100644 --- a/scripts/fetch-spec-types.ts +++ b/scripts/fetch-spec-types.ts @@ -1,6 +1,7 @@ import { writeFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; +import * as prettier from 'prettier'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); @@ -72,9 +73,12 @@ async function main() { // Combine header and content const fullContent = header + specContent; - // Write to file + // Format with prettier using the project's config so the output passes lint const outputPath = join(PROJECT_ROOT, 'packages', 'core', 'src', 'types', 'spec.types.ts'); - writeFileSync(outputPath, fullContent, 'utf-8'); + const prettierConfig = await prettier.resolveConfig(outputPath); + const formatted = await prettier.format(fullContent, { ...prettierConfig, filepath: outputPath }); + + writeFileSync(outputPath, formatted, 'utf-8'); console.log('Successfully updated packages/core/src/types/spec.types.ts'); } catch (error) {