* Main function
()
| 113 | * Main function |
| 114 | */ |
| 115 | function main(): void { |
| 116 | if (CHECK_MODE) { |
| 117 | console.log('Checking JSON schemas...\n'); |
| 118 | |
| 119 | let allValid = true; |
| 120 | for (const version of ALL_SCHEMAS) { |
| 121 | const valid = generateSchema(version, true); |
| 122 | if (!valid) { |
| 123 | allValid = false; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | console.log(); |
| 128 | if (!allValid) { |
| 129 | console.error('Error: Some schemas are out of date. Run: npm run generate:schema:json'); |
| 130 | process.exit(1); |
| 131 | } else { |
| 132 | console.log('All schemas are up to date!'); |
| 133 | } |
| 134 | } else { |
| 135 | console.log('Generating JSON schemas...\n'); |
| 136 | |
| 137 | for (const version of ALL_SCHEMAS) { |
| 138 | generateSchema(version, false); |
| 139 | } |
| 140 | |
| 141 | console.log('\nSchema generation complete!'); |
| 142 | console.log(`- (draft-07): ${LEGACY_SCHEMAS.join(', ')}`); |
| 143 | console.log(`- (2020-12): draft`); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | main(); |
no test coverage detected