Skip to content

Commit 9efecc2

Browse files
ci: format fetch-spec-types output with prettier (#1782)
1 parent d0505c1 commit 9efecc2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scripts/fetch-spec-types.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { writeFileSync } from 'node:fs';
22
import { dirname, join } from 'node:path';
33
import { fileURLToPath } from 'node:url';
4+
import * as prettier from 'prettier';
45

56
const __filename = fileURLToPath(import.meta.url);
67
const __dirname = dirname(__filename);
@@ -72,9 +73,12 @@ async function main() {
7273
// Combine header and content
7374
const fullContent = header + specContent;
7475

75-
// Write to file
76+
// Format with prettier using the project's config so the output passes lint
7677
const outputPath = join(PROJECT_ROOT, 'packages', 'core', 'src', 'types', 'spec.types.ts');
77-
writeFileSync(outputPath, fullContent, 'utf-8');
78+
const prettierConfig = await prettier.resolveConfig(outputPath);
79+
const formatted = await prettier.format(fullContent, { ...prettierConfig, filepath: outputPath });
80+
81+
writeFileSync(outputPath, formatted, 'utf-8');
7882

7983
console.log('Successfully updated packages/core/src/types/spec.types.ts');
8084
} catch (error) {

0 commit comments

Comments
 (0)