Server/project/src/Program.ts
Refringe 50c7a26a58
ESLint Pass
This is the first pass of ESLint on the codebase.

ESLint formatting is less strict when it comes to line-length and line-breaks then dprint/biome, so if you see formatting that you don't like... fix it! It shouldn't require a configuration change.

- This should merge clean into master (when the time comes).
- This will not merge clean into `3.9.0-DEV`, but the conflicts aren't that bad.
2024-05-07 23:57:08 -04:00

41 lines
1.3 KiB
TypeScript

import { container } from "tsyringe";
import { Container } from "@spt-aki/di/Container";
import { ErrorHandler } from "@spt-aki/ErrorHandler";
import type { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader";
import { App } from "@spt-aki/utils/App";
import { Watermark } from "@spt-aki/utils/Watermark";
export class Program
{
private errorHandler: ErrorHandler;
constructor()
{
// set window properties
process.stdout.setEncoding("utf8");
process.title = "SPT-AKI Server";
this.errorHandler = new ErrorHandler();
}
public async start(): Promise<void>
{
try
{
Container.registerTypes(container);
const childContainer = container.createChildContainer();
const watermark = childContainer.resolve<Watermark>("Watermark");
watermark.initialize();
const preAkiModLoader = childContainer.resolve<PreAkiModLoader>("PreAkiModLoader");
Container.registerListTypes(childContainer);
await preAkiModLoader.load(childContainer);
Container.registerPostLoadTypes(container, childContainer);
childContainer.resolve<App>("App").load();
}
catch (err: any)
{
this.errorHandler.handleCriticalError(err instanceof Error ? err : new Error(err));
}
}
}