Convert backend to ESM

- About 5 years overdue
- Remove eslint, use bomejs instead
This commit is contained in:
Jamie Curnow
2025-09-02 21:43:00 +10:00
parent 5b6ca1bf00
commit a12553fec7
89 changed files with 4799 additions and 5107 deletions

19
backend/validate-schema.js Normal file → Executable file
View File

@@ -1,16 +1,19 @@
const SwaggerParser = require('@apidevtools/swagger-parser');
const chalk = require('chalk');
const schema = require('./schema');
const log = console.log;
#!/usr/bin/node
schema.getCompiledSchema().then(async (swaggerJSON) => {
import SwaggerParser from "@apidevtools/swagger-parser";
import chalk from "chalk";
import { getCompiledSchema } from "./schema/index.js";
const log = console.log;
getCompiledSchema().then(async (swaggerJSON) => {
try {
const api = await SwaggerParser.validate(swaggerJSON);
console.log('API name: %s, Version: %s', api.info.title, api.info.version);
log(chalk.green(' Schema is valid'));
console.log("API name: %s, Version: %s", api.info.title, api.info.version);
log(chalk.green(" Schema is valid"));
} catch (e) {
console.error(e);
log(chalk.red('', e.message), '\n');
log(chalk.red("", e.message), "\n");
process.exit(1);
}
});