0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 05:10:45 -05:00
server/project/src/Program.ts
Refringe f55861528a
Compress Database Location Files (#954)
Due to LFS storage issues... This PR removes all current LFS files (the
location loot files) and replaces them with a single 7-zip archive. The
archive is stored in LFS, but has decreased in size by roughly 95%.

The location `.json` files are now git-ignored.

There are two new npm commands to aid in working with the archive:
- `npm run database:compress`  
Compresses the JSON files into an archive *which can be committed into
the project*.
- `npm run database:decompress`  
Decompresses the archive into the original JSON files located in the
working directory.

The gulp file that handles builds has been updated to ensure that the
archive files are *always* used when a build is processed, regardless of
if the JSON files are already present in the working directory.
2024-11-28 15:51:53 +00:00

40 lines
1.6 KiB
TypeScript

import { ErrorHandler } from "@spt/ErrorHandler";
import { Container } from "@spt/di/Container";
import type { PreSptModLoader } from "@spt/loaders/PreSptModLoader";
import { App } from "@spt/utils/App";
import { DatabaseDecompressionUtil } from "@spt/utils/DatabaseDecompressionUtil";
import { Watermark } from "@spt/utils/Watermark";
import { container } from "tsyringe";
export class Program {
private errorHandler: ErrorHandler;
constructor() {
// set window properties
process.stdout.setEncoding("utf8");
process.title = "SPT 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 databaseDecompressionUtil =
childContainer.resolve<DatabaseDecompressionUtil>("DatabaseDecompressionUtil");
await databaseDecompressionUtil.initialize();
const preSptModLoader = childContainer.resolve<PreSptModLoader>("PreSptModLoader");
Container.registerListTypes(childContainer);
await preSptModLoader.load(childContainer);
Container.registerPostLoadTypes(container, childContainer);
childContainer.resolve<App>("App").load();
} catch (err: any) {
this.errorHandler.handleCriticalError(err instanceof Error ? err : new Error(err));
}
}
}