Updated dependencies + A few other things (!150)

Initially this was going to be an update to dependencies but it seems i got a little carried away!

Anyways this PR removes 2 unused dependencies (`jshint` and `utf-8-validate`), and 2 other, `del` and `fs-extra` that were replaced by the built-in `fs/promises`.

It also renames all `tsconfig` and `Dockerfile` files, in a way that when viewed in a file tree sorted alphabetically they will be next to each other.

It also updates the typescript target to `ES2022`, and changes moduleResolution from `Node` to `Node10` (this isn't an update, they are the same thing but `Node` is now deprecated).

It also adds the `node:` discriminator to every import from built-in modules.

It also has major changes to the build script, `del` and `fs-extra` were only being used in the build script, it's now using `fs/promises` instead, cleaned up the code from some functions, adds better documentation to a few functions, and renames some gulp tasks and npm scripts to better represent what they actually do.

And finally it updates dependencies, except for `atomically` which can't be updated unless the project switches to ESM.

Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/150
Co-authored-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
Co-committed-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
This commit is contained in:
TheSparta 2023-10-14 09:01:41 +00:00 committed by chomp
parent 8c972908d2
commit 723f8db572
38 changed files with 223 additions and 253 deletions

View File

@ -181,7 +181,7 @@ steps:
from_secret: DOCKER_PASSWORD
username:
from_secret: DOCKER_USERNAME
dockerfile: project/docs.Dockerfile
dockerfile: project/Dockerfile.docs
context: project/
tags: latest
depends_on:

View File

@ -1,4 +1,4 @@
# NCSA Open Source License
# NCSA Open Source License
Copyright (c) 2022 Merijn Hendriks. All rights reserved.

View File

@ -2,7 +2,7 @@
!src
!types
!base_tsconfig.json
!tsconfig.base.json
!tsconfig.json
!package.json
!typedoc.json

View File

@ -9,7 +9,7 @@
"transform": {
"decoratorMetadata": true
},
"target": "es2020",
"target": "es2022",
"loose": true,
"externalHelpers": false,
// Requires v1.2.50 or upper and requires target to be es2016 or upper.

View File

@ -5,7 +5,7 @@ WORKDIR /app
COPY package.json .
RUN yarn
COPY .parcelrc tsconfig.json base_tsconfig.json ./
COPY .parcelrc tsconfig.json tsconfig.base.json ./
COPY src ./src
RUN yarn test:comp-linux

View File

@ -1,13 +1,12 @@
/* eslint-disable @typescript-eslint/naming-convention */
import crypto from "crypto";
import { deleteSync } from "del";
import fs from "fs-extra";
import gulp from "gulp";
import { exec } from "gulp-execa";
import rename from "gulp-rename";
import os from "os";
import path from "path";
import crypto from "node:crypto";
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import pkg from "pkg";
import pkgfetch from "pkg-fetch";
import * as ResEdit from "resedit";
@ -27,8 +26,15 @@ const entries = {
};
const licenseFile = "../LICENSE.md";
// Compilation
const compileTest = async () => exec("swc src -d obj", { stdio });
/**
* Transpiles the src files into javascript with swc
*/
const compile = async () => await exec("swc src -d obj", { stdio });
/**
* Transpiles the src files into javascript with tsc for the profiler run
*/
const compileProfiler = async () => await exec("tsc -p tsconfig.test.json", { stdio });
// Packaging
const fetchPackageImage = async () =>
@ -40,18 +46,6 @@ const fetchPackageImage = async () =>
console.log(`fetched node binary at ${fetchedPkg}`);
const builtPkg = fetchedPkg.replace("node", "built");
await fs.copyFile(fetchedPkg, builtPkg);
if (process.platform === "win32" || process.platform === "win64")
{
await exec(`dir ${output}`, {
stdio
});
}
else
{
await exec(`ls ${output}`, {
stdio
});
}
}
catch (e)
{
@ -60,18 +54,18 @@ const fetchPackageImage = async () =>
}
};
const updateBuildProperties = async (cb) =>
const updateBuildProperties = async () =>
{
if (os.platform() !== "win32")
{
if(os.platform() !== "win32") {
cb();
return;
}
const exe = ResEdit.NtExecutable.from(fs.readFileSync(serverExe));
const exe = ResEdit.NtExecutable.from(await fs.readFile(serverExe));
const res = ResEdit.NtExecutableResource.from(exe);
const iconPath = path.resolve(manifest.icon);
const iconFile = ResEdit.Data.IconFile.from(fs.readFileSync(iconPath));
const iconFile = ResEdit.Data.IconFile.from(await fs.readFile(iconPath));
ResEdit.Resource.IconGroupEntry.replaceIconsForResource(
res.entries,
@ -97,45 +91,33 @@ const updateBuildProperties = async (cb) =>
vi.setProductVersion(...manifest.version.split(".").map(Number));
vi.outputToResourceEntries(res.entries);
res.outputResource(exe, true);
fs.writeFileSync(serverExe, Buffer.from(exe.generate()));
cb();
await fs.writeFile(serverExe, Buffer.from(exe.generate()));
};
// Copy various asset files to the destination directory
function copyAssets()
{
return gulp.src(["assets/**/*.json", "assets/**/*.json5", "assets/**/*.png", "assets/**/*.jpg", "assets/**/*.ico"])
.pipe(gulp.dest(dataDir));
}
/**
* Copy various asset files to the destination directory
*/
const copyAssets = () => gulp.src(["assets/**/*.json", "assets/**/*.json5", "assets/**/*.png", "assets/**/*.jpg", "assets/**/*.ico"]).pipe(gulp.dest(dataDir));
// Copy executables from node_modules
function copyExecutables()
{
return gulp.src(["node_modules/@pnpm/exe/**/*"])
.pipe(gulp.dest(path.join(dataDir, "@pnpm", "exe")));
}
/**
* Copy executables from node_modules
*/
const copyExecutables = () => gulp.src(["node_modules/@pnpm/exe/**/*"]).pipe(gulp.dest(path.join(dataDir, "@pnpm", "exe")));
// Rename and copy the license file
function copyLicense()
{
return gulp.src([licenseFile])
.pipe(rename("LICENSE-Server.txt"))
.pipe(gulp.dest(buildDir));
}
/**
* Rename and copy the license file
*/
const copyLicense = () => gulp.src([licenseFile]).pipe(rename("LICENSE-Server.txt")).pipe(gulp.dest(buildDir));
/**
* Writes the latest Git commit hash to the core.json configuration file.
* @param {*} cb Callback to run after completion of function
*/
async function writeCommitHashToCoreJSON(cb)
{
const coreJSONPath = path.resolve(dataDir, "configs", "core.json");
if (fs.existsSync(coreJSONPath))
const writeCommitHashToCoreJSON = async () =>
{
try
{
const coreJSON = fs.readFileSync(coreJSONPath, "utf8");
const coreJSONPath = path.resolve(dataDir, "configs", "core.json");
const coreJSON = await fs.readFile(coreJSONPath, "utf8");
const parsed = JSON.parse(coreJSON);
// Fetch the latest Git commit hash
@ -148,51 +130,52 @@ async function writeCommitHashToCoreJSON(cb)
parsed.buildTime = new Date().getTime();
// Write the updated object back to core.json
fs.writeFileSync(coreJSONPath, JSON.stringify(parsed, null, 4));
await fs.writeFile(coreJSONPath, JSON.stringify(parsed, null, 4));
}
catch (error)
{
throw new Error(`Failed to write commit hash to core.json: ${error.message}`);
}
}
else
{
console.warn(`core.json not found at ${coreJSONPath}. Skipping commit hash update.`);
}
};
cb();
}
// Create a hash file for asset checks
async function createHashFile()
/**
* Create a hash file for asset checks
*/
const createHashFile = async () =>
{
const hashFileDir = path.resolve(dataDir, "checks.dat");
await fs.createFile(hashFileDir);
const assetData = await loadRecursiveAsync("assets/");
const assetDataString = Buffer.from(JSON.stringify(assetData), "utf-8").toString("base64");
await fs.writeFile(hashFileDir, assetDataString);
}
};
// Combine all tasks into addAssets
const addAssets = gulp.series(copyAssets, copyExecutables, copyLicense, writeCommitHashToCoreJSON, createHashFile);
// Cleanup
const clean = (cb) =>
{
deleteSync(buildDir, { force: true });
cb();
};
const removeCompiled = async () => fs.rmSync("./obj", { recursive: true, force: true });
/**
* Cleans the build directory.
*/
const cleanBuild = async () => await fs.rm(buildDir, { recursive: true, force: true });
// JSON Validation
function getJSONFiles(dir, files = [])
/**
* Cleans the transpiled javascript directory.
*/
const cleanCompiled = async () => await fs.rm("./obj", { recursive: true, force: true });
/**
* Recursively builds an array of paths for json files.
*
* @param {fs.PathLike} dir
* @param {string[]} files
* @returns {Promise<string[]>}
*/
const getJSONFiles = async (dir, files = []) =>
{
const fileList = fs.readdirSync(dir);
const fileList = await fs.readdir(dir);
for (const file of fileList)
{
const name = path.resolve(dir, file);
if (fs.statSync(name).isDirectory())
if ((await fs.stat(name)).isDirectory())
{
getJSONFiles(name, files);
}
@ -202,22 +185,23 @@ function getJSONFiles(dir, files = [])
}
}
return files;
}
};
const validateJSONs = (cb) =>
/**
* Goes through every json file in assets and makes sure they're valid json.
*/
const validateJSONs = async () =>
{
const assetsPath = path.resolve("assets");
const jsonFileList = getJSONFiles(assetsPath);
const jsonFileList = await getJSONFiles(assetsPath);
let jsonFileInProcess = "";
try
{
jsonFileList.forEach((jsonFile) =>
for (const jsonFile of jsonFileList)
{
jsonFileInProcess = jsonFile;
const jsonString = fs.readFileSync(jsonFile).toString();
JSON.parse(jsonString);
});
cb();
JSON.parse(await fs.readFile(jsonFile));
}
}
catch (error)
{
@ -225,7 +209,12 @@ const validateJSONs = (cb) =>
}
};
// Hash helper function
/**
* Hash helper function
*
* @param {crypto.BinaryLike} data
* @returns {string}
*/
const generateHashForData = (data) =>
{
const hashSum = crypto.createHash("sha1");
@ -233,36 +222,29 @@ const generateHashForData = (data) =>
return hashSum.digest("hex");
};
// Loader to recursively find all json files in a folder
/**
* Loader to recursively find all json files in a folder
*
* @param {fs.PathLike} filepath
* @returns {}
*/
const loadRecursiveAsync = async (filepath) =>
{
const result = {};
// get all filepaths
const files = fs.readdirSync(filepath).filter((item) =>
{
return fs.statSync(path.join(filepath, item)).isFile();
});
const directories = fs.readdirSync(filepath).filter((item) =>
{
return fs.statSync(path.join(filepath, item)).isDirectory();
});
const filesList = await fs.readdir(filepath);
// add file content to result
for (const file of files)
for (const file of filesList)
{
if (file.split(".").pop() === "json")
const curPath = path.parse(path.join(filepath, file));
if ((await fs.stat(path.join(curPath.dir, curPath.base))).isDirectory())
{
const filename = file.split(".").slice(0, -1).join(".");
const filePathAndName = `${filepath}${file}`;
result[filename] = generateHashForData(fs.readFileSync(filePathAndName));
result[curPath.name] = loadRecursiveAsync(`${filepath}${file}/`);
}
}
// deep tree search
for (const dir of directories)
else if (curPath.ext === ".json")
{
result[dir] = loadRecursiveAsync(`${filepath}${dir}/`);
result[curPath.name] = generateHashForData(await fs.readFile(`${filepath}${file}`));
}
}
// set all loadRecursive to be executed asynchronously
@ -277,15 +259,12 @@ const loadRecursiveAsync = async (filepath) =>
return Object.fromEntries(resEntries);
};
// Testing
gulp.task("test:debug", async () => exec("ts-node-dev -r tsconfig-paths/register src/ide/TestEntry.ts", { stdio }));
// Main Tasks Generation
const build = (packagingType) =>
{
const anonPackaging = () => packaging(entries[packagingType]);
anonPackaging.displayName = `packaging-${packagingType}`;
const tasks = [clean, validateJSONs, compileTest, fetchPackageImage, anonPackaging, addAssets, updateBuildProperties, removeCompiled];
const tasks = [cleanBuild, validateJSONs, compile, fetchPackageImage, anonPackaging, addAssets, updateBuildProperties, cleanCompiled];
return gulp.series(tasks);
};
@ -293,6 +272,7 @@ const build = (packagingType) =>
const packaging = async (entry) =>
{
const target = `${nodeVersion}-${process.platform}-${process.arch}`;
console.log("target", target);
const args = [entry, "--compress", "GZip", "--target", target, "--output", serverExe, "--config", pkgConfig];
try
{
@ -304,14 +284,14 @@ const packaging = async (entry) =>
}
};
// Run server
const runSrv = async (cb) =>
{
await exec("Aki.Server.exe", { stdio, cwd: buildDir });
cb();
};
gulp.task("build:debug", build("debug"));
gulp.task("build:release", build("release"));
gulp.task("build:bleeding", build("bleeding"));
gulp.task("run:server", runSrv);
gulp.task("run:build", async () => await exec("Aki.Server.exe", { stdio, cwd: buildDir }));
gulp.task("run:debug", async () => await exec("ts-node-dev -r tsconfig-paths/register src/ide/TestEntry.ts", { stdio }));
gulp.task("run:profiler", async () =>
{
await compileProfiler();
await exec("node --prof --inspect --trace-warnings obj/ide/TestEntry.js", { stdio });
});

View File

@ -11,20 +11,19 @@
"node": "18.15.0"
},
"scripts": {
"profilerCompile": "tsc -p test_tsconfig.json",
"run:profiler": "npm run profilerCompile && node --prof --inspect --trace-warnings obj/ide/TestEntry.js",
"check:circular": "npx madge --circular --extensions ts ./src/",
"check:circular": "madge --circular --extensions ts ./src/",
"lint": "rome ci src --formatter-enabled=false --max-diagnostics=200",
"lint:fix": "eslint --fix --ext .ts src/**",
"test:debug": "gulp test:debug",
"test:run": "jest --colors --runInBand",
"test:coverage": "jest --coverage --maxWorkers=1 --no-cache",
"build:release": "cross-env PKG_CACHE_PATH=\"./.pkg-cache\" gulp build:release",
"build:debug": "cross-env PKG_CACHE_PATH=\"./.pkg-cache\" gulp build:debug",
"build:bleeding": "cross-env PKG_CACHE_PATH=\"./.pkg-cache\" gulp build:bleeding",
"gen:types": "tsc -p typedef_tsconfig.json",
"gen:docs": "typedoc --options ./typedoc.json --entryPointStrategy expand ./src",
"run:server": "gulp run:server"
"run:build": "gulp run:build",
"run:debug": "gulp run:debug",
"run:profiler": "gulp run:profiler",
"gen:types": "tsc -p tsconfig.typedef.json",
"gen:docs": "typedoc --options ./typedoc.json --entryPointStrategy expand ./src"
},
"dependencies": {
"atomically": "1.7.0",
@ -37,36 +36,33 @@
"semver": "7.5.4",
"source-map-support": "0.5.21",
"tsyringe": "4.8.0",
"typescript": "5.1.6",
"winston": "3.10.0",
"typescript": "5.2.2",
"winston": "3.11.0",
"winston-daily-rotate-file": "4.7.1",
"ws": "8.13.0"
"ws": "8.14.2"
},
"devDependencies": {
"@babel/preset-env": "7.22.9",
"@babel/preset-typescript": "7.22.5",
"@jest/globals": "29.6.2",
"@pnpm/exe": "8.8.0",
"@babel/preset-env": "7.23.2",
"@babel/preset-typescript": "7.23.2",
"@jest/globals": "29.7.0",
"@pnpm/exe": "8.9.0",
"@swc/cli": "0.1.62",
"@swc/core": "1.3.72",
"@swc/jest": "0.2.27",
"@types/i18n": "0.13.6",
"@types/jest": "29.5.3",
"@types/node": "20.4.5",
"@swc/core": "1.3.92",
"@swc/jest": "0.2.29",
"@types/i18n": "0.13.7",
"@types/jest": "29.5.5",
"@types/node": "18.18.4",
"@types/proper-lockfile": "4.1.2",
"@types/semver": "7.5.0",
"@types/ws": "8.5.5",
"@typescript-eslint/eslint-plugin": "6.2.0",
"@typescript-eslint/parser": "6.2.0",
"@types/semver": "7.5.3",
"@types/ws": "8.5.7",
"@typescript-eslint/eslint-plugin": "6.7.5",
"@typescript-eslint/parser": "6.7.5",
"cross-env": "7.0.3",
"del": "7.0.0",
"eslint": "8.46.0",
"fs-extra": "11.1.1",
"eslint": "8.51.0",
"gulp": "4.0.2",
"gulp-execa": "5.0.0",
"gulp-execa": "5.0.1",
"gulp-rename": "2.0.0",
"jest": "29.6.2",
"jshint": "2.13.6",
"jest": "29.7.0",
"madge": "6.1.0",
"pkg": "5.8.1",
"pkg-fetch": "3.5.2",
@ -75,9 +71,8 @@
"ts-jest": "29.1.1",
"ts-node-dev": "2.0.0",
"tsconfig-paths": "4.2.0",
"typedoc": "0.24.8",
"typemoq": "2.1.0",
"utf-8-validate": "6.0.3"
"typedoc": "0.25.2",
"typemoq": "2.1.0"
},
"overrides": {
"pkg": {

View File

@ -35,7 +35,7 @@
"**/*.js",
"**/*.json",
"**/*.mjs",
"**/*.Dockerfile",
"**/Dockerfile.*",
"**/node_modules/**/*"
]
}

View File

@ -43,8 +43,6 @@ import { TimeUtil } from "../utils/TimeUtil";
@injectable()
export class GameController
{
protected os = require("os");
protected httpConfig: IHttpConfig;
protected coreConfig: ICoreConfig;
protected locationConfig: ILocationConfig;

View File

@ -1,4 +1,4 @@
import { IncomingMessage, ServerResponse } from "http";
import { IncomingMessage, ServerResponse } from "node:http";
export class Serializer
{

View File

@ -1,6 +1,6 @@
import { execSync } from "child_process";
import os from "os";
import path from "path";
import { execSync } from "node:child_process";
import os from "node:os";
import path from "node:path";
import semver from "semver";
import { DependencyContainer, inject, injectable } from "tsyringe";
import { ModDetails } from "../models/eft/profile/IAkiProfile";

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { IncomingMessage, ServerResponse } from "http";
import { IncomingMessage, ServerResponse } from "node:http";
import { injectable } from "tsyringe";
import { HttpMethods } from "../../servers/http/HttpMethods";

View File

@ -1,4 +1,4 @@
import { IncomingMessage } from "http";
import { IncomingMessage } from "node:http";
import { injectable, injectAll } from "tsyringe";
import { DynamicRouter, Router, StaticRouter } from "../di/Router";

View File

@ -1,4 +1,4 @@
import { IncomingMessage, ServerResponse } from "http";
import { IncomingMessage, ServerResponse } from "node:http";
import { inject, injectable } from "tsyringe";
import { ImageRouteService } from "../services/mod/image/ImageRouteService";

View File

@ -1,4 +1,4 @@
import { IncomingMessage, ServerResponse } from "http";
import { IncomingMessage, ServerResponse } from "node:http";
import { inject, injectable } from "tsyringe";
import { Serializer } from "../../di/Serializer";

View File

@ -1,4 +1,4 @@
import { IncomingMessage, ServerResponse } from "http";
import { IncomingMessage, ServerResponse } from "node:http";
import { inject, injectable } from "tsyringe";
import { Serializer } from "../../di/Serializer";

View File

@ -1,4 +1,4 @@
import { IncomingMessage, ServerResponse } from "http";
import { IncomingMessage, ServerResponse } from "node:http";
import { inject, injectable } from "tsyringe";
import { NotifierController } from "../../controllers/NotifierController";

View File

@ -1,4 +1,4 @@
import http, { IncomingMessage, ServerResponse } from "http";
import http, { IncomingMessage, ServerResponse } from "node:http";
import { inject, injectable, injectAll } from "tsyringe";
import { ApplicationContext } from "../context/ApplicationContext";

View File

@ -1,4 +1,4 @@
import http, { IncomingMessage } from "http";
import http, { IncomingMessage } from "node:http";
import { inject, injectable } from "tsyringe";
import WebSocket from "ws";

View File

@ -1,6 +1,6 @@
import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from "http";
import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from "node:http";
import zlib from "node:zlib";
import { inject, injectAll, injectable } from "tsyringe";
import zlib from "zlib";
import { Serializer } from "../../di/Serializer";
import { ILogger } from "../../models/spt/utils/ILogger";

View File

@ -1,4 +1,4 @@
import { IncomingMessage, ServerResponse } from "http";
import { IncomingMessage, ServerResponse } from "node:http";
export interface IHttpListener
{

View File

@ -1,12 +1,12 @@
import { I18n } from "i18n";
import { inject, injectable } from "tsyringe";
import path from "node:path";
import { ILocaleConfig } from "../models/spt/config/ILocaleConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { RandomUtil } from "../utils/RandomUtil";
import { LocaleService } from "./LocaleService";
import path from "path";
/**
* Handles translating server text into different langauges

View File

@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/naming-convention */
import fs from "fs";
import path from "path";
import fs from "node:fs";
import path from "node:path";
import { inject, injectable } from "tsyringe";
import { CompilerOptions, ModuleKind, ScriptTarget, TranspileOptions, transpileModule } from "typescript";
import { CompilerOptions, ModuleKind, ModuleResolutionKind, ScriptTarget, TranspileOptions, transpileModule } from "typescript";
import type { ILogger } from "../models/spt/utils/ILogger";
import { VFS } from "../utils/VFS";
import { HashCacheService } from "./HashCacheService";
@ -64,8 +64,9 @@ export class ModCompilerService
{
noEmitOnError: true,
noImplicitAny: false,
target: ScriptTarget.ES2020,
target: ScriptTarget.ES2022,
module: ModuleKind.CommonJS,
moduleResolution: ModuleResolutionKind.Node10,
resolveJsonModule: true,
allowJs: true,
esModuleInterop: true,

View File

@ -1,4 +1,4 @@
import { IncomingMessage, ServerResponse } from "http";
import { IncomingMessage, ServerResponse } from "node:http";
import { IHttpListener } from "../../../servers/http/IHttpListener";
export class HttpListenerMod implements IHttpListener

View File

@ -1,4 +1,4 @@
import { IncomingMessage, ServerResponse } from "http";
import { IncomingMessage, ServerResponse } from "node:http";
import { DependencyContainer, injectable } from "tsyringe";
import { IHttpListener } from "../../../servers/http/IHttpListener";
import { HttpListenerMod } from "./HttpListenerMod";

View File

@ -1,6 +1,7 @@
import sourcemapSupport from "source-map-support";
import { inject, injectable, injectAll } from "tsyringe";
import os from "node:os";
import { OnLoad } from "../di/OnLoad";
import { OnUpdate } from "../di/OnUpdate";
import { ILogger } from "../models/spt/utils/ILogger";
@ -12,7 +13,6 @@ import { TimeUtil } from "./TimeUtil";
export class App
{
protected onUpdateLastRun = {};
protected os = require("os");
constructor(
@inject("WinstonLogger") protected logger: ILogger,
@ -32,9 +32,9 @@ export class App
// execute onLoad callbacks
this.logger.info(this.localisationService.getText("executing_startup_callbacks"));
this.logger.debug(`OS: ${this.os.arch()} | ${this.os.version()} | ${process.platform}`);
this.logger.debug(`CPU: ${this.os?.cpus()[0]?.model} cores: ${this.os.availableParallelism()}`);
this.logger.debug(`RAM: ${(this.os.totalmem() / 1024 / 1024 / 1024).toFixed(2)}GB`);
this.logger.debug(`OS: ${os.arch()} | ${os.version()} | ${process.platform}`);
this.logger.debug(`CPU: ${os.cpus()[0]?.model} cores: ${os.cpus().length}`);
this.logger.debug(`RAM: ${(os.totalmem() / 1024 / 1024 / 1024).toFixed(2)}GB`);
this.logger.debug(`PATH: ${this.encodingUtil.toBase64(process.argv[0])}`);
this.logger.debug(`PATH: ${this.encodingUtil.toBase64(process.execPath)}`);

View File

@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import { inject, injectable } from "tsyringe";
import { TimeUtil } from "./TimeUtil";

View File

@ -1,5 +1,5 @@
import fs from "fs";
import { ServerResponse } from "http";
import fs from "node:fs";
import { ServerResponse } from "node:http";
import { inject, injectable } from "tsyringe";
import { HttpServerHelper } from "../helpers/HttpServerHelper";

View File

@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import { TimeUtil } from "./TimeUtil";
import { inject, injectable } from "tsyringe";

View File

@ -1,10 +1,10 @@
import { writeFileSync } from "atomically";
import fs from "fs";
import path, { resolve } from "path";
import fs from "node:fs";
import path, { resolve } from "node:path";
import { promisify } from "node:util";
import lockfile from "proper-lockfile";
import "reflect-metadata";
import { inject, injectable } from "tsyringe";
import { promisify } from "util";
import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue";
import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator";

View File

@ -10,21 +10,22 @@ import { LocalisationService } from "../services/LocalisationService";
@injectable()
export class WatermarkLocale
{
protected description: string[];
protected warning: string[];
protected modding: string[];
constructor(
@inject("LocalisationService") protected localisationService: LocalisationService
)
{}
protected watermark = {
// eslint-disable-next-line @typescript-eslint/naming-convention
"description": [
{
this.description = [
this.localisationService.getText("watermark-discord_url"),
"",
this.localisationService.getText("watermark-free_of_charge"),
this.localisationService.getText("watermark-paid_scammed"),
this.localisationService.getText("watermark-commercial_use_prohibited")
],
"warning": [
];
this.warning = [
"",
this.localisationService.getText("watermark-testing_build"),
this.localisationService.getText("watermark-no_support"),
@ -33,29 +34,29 @@ export class WatermarkLocale
this.localisationService.getText("watermark-issue_tracker_url"),
"",
this.localisationService.getText("watermark-use_at_own_risk")
],
"modding": [
];
this.modding = [
"",
this.localisationService.getText("watermark-modding_disabled"),
"",
this.localisationService.getText("watermark-not_an_issue"),
this.localisationService.getText("watermark-do_not_report")
]
};
];
}
public getDescription(): string[]
{
return this.watermark.description;
return this.description;
}
public getWarning(): string[]
{
return this.watermark.warning;
return this.warning;
}
public getModding(): string[]
{
return this.watermark.modding;
return this.modding;
}
}

View File

@ -1,5 +1,5 @@
import fs from "fs";
import { promisify } from "util";
import fs from "node:fs";
import { promisify } from "node:util";
import winston, { createLogger, format, transports } from "winston";
import DailyRotateFile from "winston-daily-rotate-file";

View File

@ -1,18 +1,15 @@
{
"compilerOptions": {
"allowJs": false,
"module": "commonjs",
"target": "es2021",
"module": "CommonJS",
"target": "ES2022",
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"moduleResolution": "Node10",
"esModuleInterop": true,
"downlevelIteration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"lib": [
"es2020"
],
"include": [
"src/*",
"src/**/*"

View File

@ -1,11 +1,9 @@
{
"extends": "./base_tsconfig.json",
"extends": "./tsconfig.base.json",
"compilerOptions": {
"resolveJsonModule": true,
"outDir": "obj",
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"baseUrl": ".",
"paths": {
"@spt-aki/*": [

View File

@ -1,5 +1,5 @@
{
"extends": "./base_tsconfig.json",
"extends": "./tsconfig.base.json",
"compilerOptions": {
"outDir": "obj",
"declaration": true,

View File

@ -1,5 +1,5 @@
{
"extends": "./base_tsconfig.json",
"extends": "./tsconfig.base.json",
"compilerOptions": {
"emitDeclarationOnly": true,
"declaration": true,