Convert backend to ESM

- About 5 years overdue
- Remove eslint, use bomejs instead
This commit is contained in:
Jamie Curnow
2025-10-02 08:10:18 +10:00
parent 487fa6d31b
commit 330993f028
89 changed files with 4799 additions and 5107 deletions
Regular → Executable
+11 -8
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);
}
});