a2a-js/scripts/generateTypes.js
Guglielmo Colombo 542c5fba70
ci: integrate prettier check in github workflow (#185)
# Description

This PR integrates the prettier check in the github workflow to ensure
the code respects the correct formatting standards

Fixes #177  馃

---------

Co-authored-by: Ivan Shymko <vana.shimko@gmail.com>
2025-11-18 17:06:18 +01:00

14 lines
453 B
JavaScript

import { compile } from 'json-schema-to-typescript';
import fs from 'fs';
import path from 'path';
const typeSchemaContents = fs.readFileSync(path.join(process.cwd(), 'spec.json'), 'utf8');
const typeSchema = JSON.parse(typeSchemaContents.toString());
compile(typeSchema, 'MySchema', {
additionalProperties: false,
enableConstEnums: false,
unreachableDefinitions: true,
unknownAny: true,
}).then((ts) => fs.writeFileSync('src/types.ts', ts));