0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 02:10:44 -05:00

Auto-formatting of root-level files.

This commit is contained in:
Refringe 2023-11-10 15:16:53 -05:00
parent 12891ceac6
commit 90cdd6eea1
No known key found for this signature in database
GPG Key ID: 64E03E5F892C6F9E
6 changed files with 63 additions and 40 deletions

View File

@ -1,4 +1,4 @@
FROM node:16-buster as builder
FROM node:16-buster AS builder
WORKDIR /app
@ -9,7 +9,6 @@ COPY tsconfig.json tsconfig.base.json ./
COPY src ./src
RUN yarn test:comp-linux
##############################################
FROM debian:buster

View File

@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import gulp from "gulp";
import { exec } from "gulp-execa";
import rename from "gulp-rename";
@ -22,12 +20,12 @@ const pkgConfig = "pkgconfig.json";
const entries = {
release: path.join("obj", "ide", "ReleaseEntry.js"),
debug: path.join("obj", "ide", "DebugEntry.js"),
bleeding: path.join("obj", "ide", "BleedingEdgeEntry.js")
bleeding: path.join("obj", "ide", "BleedingEdgeEntry.js"),
};
const licenseFile = "../LICENSE.md";
/**
* Transpiles the src files into javascript with swc
* Transpile src files into Javascript with SWC
*/
const compile = async () => await exec("swc src -d obj", {stdio});
@ -37,7 +35,12 @@ const fetchPackageImage = async () =>
try
{
const output = "./.pkg-cache/v3.5";
const fetchedPkg = await pkgfetch.need({ arch: process.arch, nodeRange: nodeVersion, platform: process.platform, output });
const fetchedPkg = await pkgfetch.need({
arch: process.arch,
nodeRange: nodeVersion,
platform: process.platform,
output,
});
console.log(`fetched node binary at ${fetchedPkg}`);
const builtPkg = fetchedPkg.replace("node", "built");
await fs.copyFile(fetchedPkg, builtPkg);
@ -66,7 +69,7 @@ const updateBuildProperties = async () =>
res.entries,
1,
1033,
iconFile.icons.map(item => item.data)
iconFile.icons.map((item) => item.data),
);
const vi = ResEdit.Resource.VersionInfo.fromEntries(res.entries)[0];
@ -77,8 +80,8 @@ const updateBuildProperties = async () =>
ProductName: manifest.author,
FileDescription: manifest.description,
CompanyName: manifest.name,
LegalCopyright: manifest.license
}
LegalCopyright: manifest.license,
},
);
vi.removeStringValue({lang: 1033, codepage: 1200}, "OriginalFilename");
vi.removeStringValue({lang: 1033, codepage: 1200}, "InternalName");
@ -92,12 +95,16 @@ const updateBuildProperties = async () =>
/**
* 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));
const copyAssets = () =>
gulp.src(["assets/**/*.json", "assets/**/*.json5", "assets/**/*.png", "assets/**/*.jpg", "assets/**/*.ico"]).pipe(
gulp.dest(dataDir),
);
/**
* Copy executables from node_modules
*/
const copyExecutables = () => gulp.src(["node_modules/@pnpm/exe/**/*"]).pipe(gulp.dest(path.join(dataDir, "@pnpm", "exe")));
const copyExecutables = () =>
gulp.src(["node_modules/@pnpm/exe/**/*"]).pipe(gulp.dest(path.join(dataDir, "@pnpm", "exe")));
/**
* Rename and copy the license file
@ -244,7 +251,7 @@ const loadRecursiveAsync = async (filepath) =>
// set all loadRecursive to be executed asynchronously
const resEntries = Object.entries(result);
const resResolved = await Promise.all(resEntries.map(ent => ent[1]));
const resResolved = await Promise.all(resEntries.map((ent) => ent[1]));
for (let resIdx = 0; resIdx < resResolved.length; resIdx++)
{
resEntries[resIdx][1] = resResolved[resIdx];
@ -259,7 +266,16 @@ const build = (packagingType) =>
{
const anonPackaging = () => packaging(entries[packagingType]);
anonPackaging.displayName = `packaging-${packagingType}`;
const tasks = [cleanBuild, validateJSONs, compile, fetchPackageImage, anonPackaging, addAssets, updateBuildProperties, cleanCompiled];
const tasks = [
cleanBuild,
validateJSONs,
compile,
fetchPackageImage,
anonPackaging,
addAssets,
updateBuildProperties,
cleanCompiled,
];
return gulp.series(tasks);
};
@ -269,7 +285,18 @@ const packaging = async (entry) =>
const target = `${nodeVersion}-${process.platform}-${process.arch}`;
try
{
await pkg.exec([entry, "--compress", "GZip", "--target", target, "--output", serverExe, "--config", pkgConfig, "--public"]);
await pkg.exec([
entry,
"--compress",
"GZip",
"--target",
target,
"--output",
serverExe,
"--config",
pkgConfig,
"--public",
]);
}
catch (error)
{

View File

@ -14,7 +14,7 @@ export class ErrorHandler
this.logger = new WinstonMainLogger(new AsyncQueue());
this.readLine = readline.createInterface({
input: process.stdin,
output: process.stdout
output: process.stdout,
});
}
@ -27,7 +27,6 @@ export class ErrorHandler
this.logger.error(`\nStacktrace:\n${err.stack}`);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
this.readLine.question("Press Enter to close the window", (_ans) => this.readLine.close());
this.readLine.on("close", () => process.exit(1));
}

View File

@ -1,14 +1,13 @@
import { container } from "tsyringe";
import { ErrorHandler } from "@spt-aki/ErrorHandler";
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()
{
@ -36,7 +35,7 @@ export class Program
}
catch (err: any)
{
this.errorHandler.handleCriticalError((err instanceof Error ? err : new Error(err)));
this.errorHandler.handleCriticalError(err instanceof Error ? err : new Error(err));
}
}
}

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import path from "node:path";
import { defineConfig } from "vitest/config";
@ -9,7 +8,7 @@ export default defineConfig({
root: "./",
include: ["**/*.{test,spec}.?(c|m)[jt]s?(x)"],
cache: {
dir: "./tests/__cache__"
dir: "./tests/__cache__",
},
environment: "./tests/CustomEnvironment.ts",
globals: true,
@ -20,18 +19,18 @@ export default defineConfig({
reportOnFailure: true,
all: true,
include: ["src"],
exclude: ["src/models/**", "tests/**"]
exclude: ["src/models/**", "tests/**"],
},
pool: "threads",
poolOptions: {
threads: {
singleThread: true,
isolate: false
}
isolate: false,
},
},
alias: {
"@spt-aki": path.resolve(__dirname, "src"),
"@tests": path.resolve(__dirname, "tests")
}
}
"@tests": path.resolve(__dirname, "tests"),
},
},
});