Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions scripts/fetch-spec-types.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
Loading