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

Updates NPM Packages - Node v20.11.1 LTS (!260)

Updates many of the out of date npm packages and brings us up to Node v20 LTS. :D

Co-authored-by: chomp <chomp@noreply.dev.sp-tarkov.com>
Reviewed-on: SPT-AKI/Server#260
Co-authored-by: Refringe <me@refringe.com>
Co-committed-by: Refringe <me@refringe.com>
This commit is contained in:
Refringe 2024-03-14 09:08:40 +00:00 committed by chomp
parent 1dc5db42f3
commit 5edba7dd05
8 changed files with 1702 additions and 2814 deletions

View File

@ -21,7 +21,7 @@ git config --local user.email "USERNAME@SOMETHING.com"
## Observations
- The server was tested to work with **NodeJS 20.10.0**, if you are using a different version and experiencing difficulties change it before looking for support
- The server was tested to work with **NodeJS v20.11.1**, if you are using a different version and experiencing difficulties change it before looking for support
- If you are updating a branch you've had for some time, run `npm ci` before running any tasks. This will run the clean and install target from npm.
- You can debug your mods using the server, just copy your mod files into the `user/mods` folder and put breakpoints on the **JS** files. **DO NOT** contact the dev team for support on this.
@ -347,6 +347,6 @@ Player profile is stored in SPT folder as a JSON file, allowing for changes to p
- TypeScript
- Majority of EFT request/response classes passed from client to server have been mapped
- Unit Tests
- Supports tests via jest
- Supports tests via vitest
- Dependency injection
- Config files accessible from `Aki_Data\Server\configs` / `project\assets\configs`
- Config files accessible from `Aki_Data\Server\configs` / `project\assets\configs`

View File

@ -1 +1 @@
v20.10.0
v20.11.1

View File

@ -4,7 +4,7 @@
{
"name": "Debug",
"type": "node",
"runtimeVersion": "20.10.0",
"runtimeVersion": "20.11.1",
"runtimeExecutable": "npm",
"request": "launch",
"sourceMaps": true,
@ -21,7 +21,7 @@
{
"name": "Run Vitest Tests",
"type": "node",
"runtimeVersion": "20.10.0",
"runtimeVersion": "20.11.1",
"runtimeExecutable": "npm",
"request": "launch",
"runtimeArgs": [

View File

@ -13,6 +13,7 @@
"rules": {
"recommended": true,
"style": {
"useImportType": "off",
"noImplicitBoolean": "off",
"noParameterAssign": "warn",
"useTemplate": "warn",

View File

@ -1,35 +1,26 @@
import crypto from "node:crypto";
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import pkg from "@yao-pkg/pkg";
import pkgfetch from "@yao-pkg/pkg-fetch";
import fs from "fs-extra";
import gulp from "gulp";
import decompress from "gulp-decompress";
import download from "gulp-download";
import { exec } from "gulp-execa";
import rename from "gulp-rename";
import download from "gulp-download";
import decompress from "gulp-decompress";
import minimist from "minimist";
// eslint-disable-next-line @typescript-eslint/naming-convention
import * as ResEdit from "resedit";
import manifest from "./package.json" assert { type: "json" };
const knownOptions = {
string: ["arch", "platform"],
default: {
arch: process.arch,
platform: process.platform
}
}
const options = minimist(process.argv.slice(2), knownOptions)
// Accept command line arguments for arch and platform
const knownOptions = { string: ["arch", "platform"], default: { arch: process.arch, platform: process.platform } };
const options = minimist(process.argv.slice(2), knownOptions);
const targetArch = options.arch;
const targetPlatform = options.platform;
console.log(`target arch: ${targetArch}, target platform: ${targetPlatform}`);
console.log(`target arch: ${targetArch}, target platform: ${targetPlatform}`)
const nodeVersion = "node20"; // As of @yao-pkg/pkg-fetch v3.5.7, it's v20.10.0
const nodeVersion = "node20"; // As of @yao-pkg/pkg-fetch v3.5.9, it's v20.11.1
const stdio = "inherit";
const buildDir = "build/";
const dataDir = path.join(buildDir, "Aki_Data", "Server");
@ -46,7 +37,32 @@ const licenseFile = "../LICENSE.md";
/**
* Transpile src files into Javascript with SWC
*/
const compile = async () => await exec("swc src -d obj", { stdio });
const compile = async () =>
{
// Compile TypeScript files using SWC
await exec("npx swc src -d obj", { stdio: "inherit" });
// Merge the contents from the /obj/src directory into /obj
const srcDir = path.join("obj", "src");
const destDir = path.join("obj");
try
{
const entities = await fs.readdir(srcDir);
for (const entity of entities)
{
const srcPath = path.join(srcDir, entity);
const destPath = path.join(destDir, entity);
await fs.move(srcPath, destPath, { overwrite: true });
}
// After moving all contents, remove the now-empty /obj/src directory
await fs.remove(srcDir);
}
catch (error)
{
console.error("An error occurred during the merge operation:", error);
}
};
// Packaging
const fetchPackageImage = async () =>
@ -76,7 +92,7 @@ const updateBuildProperties = async () =>
if (targetPlatform !== "win32")
{
// can't modify executable's resource on non-windows build
return
return;
}
const exe = ResEdit.NtExecutable.from(await fs.readFile(serverExe));
@ -120,14 +136,17 @@ const copyAssets = () =>
/**
* Download pnpm executable
*/
const downloadPnpm = async () => {
const downloadPnpm = async () =>
{
// Please ensure that the @pnpm/exe version in devDependencies is pinned to a specific version. If it's not, the
// following task will download *all* versions that are compatible with the semver range specified.
const pnpmVersion = manifest.devDependencies["@pnpm/exe"];
const pnpmPackageName = `@pnpm/${targetPlatform === "win32" ? "win" : targetPlatform}-${targetArch}`;
const npmResult = await exec(`npm view ${pnpmPackageName}@${pnpmVersion} dist.tarball`, {stdout: "pipe"});
const pnpmLink = npmResult.stdout.trim()
console.log(`Downloading pnpm binary from ${pnpmLink}`)
download(pnpmLink).pipe(decompress({strip: 1})).pipe(gulp.dest(path.join(dataDir, "@pnpm", "exe")));
}
const npmResult = await exec(`npm view ${pnpmPackageName}@${pnpmVersion} dist.tarball`, { stdout: "pipe" });
const pnpmLink = npmResult.stdout.trim();
console.log(`Downloading pnpm binary from ${pnpmLink}`);
download(pnpmLink).pipe(decompress({ strip: 1 })).pipe(gulp.dest(path.join(dataDir, "@pnpm", "exe")));
};
/**
* Rename and copy the license file

4336
project/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
"description": "The single-player modding framework for Escape From Tarkov.",
"icon": "assets/images/icon.ico",
"engines": {
"node": "20.10.0"
"node": "20.11.1"
},
"scripts": {
"check:circular": "madge --circular --ts-config tsconfig.json --extensions ts ./src/",
@ -30,55 +30,56 @@
"gen:docs": "typedoc --options ./typedoc.json --entryPointStrategy expand ./src"
},
"dependencies": {
"atomically": "1.7.0",
"date-fns": "2.30.0",
"date-fns-tz": "2.0.0",
"i18n": "0.15.1",
"json-fixer": "1.6.15",
"json5": "2.2.3",
"jsonc": "2.0.0",
"proper-lockfile": "4.1.2",
"reflect-metadata": "0.2.1",
"semver": "7.5.4",
"source-map-support": "0.5.21",
"tsyringe": "4.8.0",
"typescript": "5.3.3",
"winston": "3.11.0",
"winston-daily-rotate-file": "4.7.1",
"ws": "8.15.1"
"atomically": "~1.7",
"date-fns": "~2.30",
"date-fns-tz": "~2.0",
"i18n": "~0.15",
"json-fixer": "~1.6",
"json5": "~2.2",
"jsonc": "~2.0",
"proper-lockfile": "~4.1",
"reflect-metadata": "~0.2",
"semver": "~7.6",
"source-map-support": "~0.5",
"tsyringe": "~4.8",
"typescript": "~5.4",
"winston": "~3.12",
"winston-daily-rotate-file": "~5.0",
"ws": "~8.16"
},
"devDependencies": {
"@biomejs/biome": "1.4.1",
"@pnpm/exe": "8.12.1",
"@swc/cli": "0.1.63",
"@swc/core": "1.3.101",
"@types/i18n": "0.13.10",
"@types/node": "20.10.5",
"@types/proper-lockfile": "4.1.4",
"@types/semver": "7.5.6",
"@types/ws": "8.5.10",
"@typescript-eslint/eslint-plugin": "6.15.0",
"@typescript-eslint/parser": "6.15.0",
"@vitest/coverage-istanbul": "1.1.0",
"@vitest/ui": "1.1.0",
"@yao-pkg/pkg": "5.11.0",
"@yao-pkg/pkg-fetch": "3.5.7",
"cross-env": "7.0.3",
"dprint": "0.44.0",
"eslint": "8.56.0",
"gulp": "4.0.2",
"gulp-decompress": "3.0.0",
"gulp-download": "0.0.1",
"gulp-execa": "6.0.0",
"gulp-rename": "2.0.0",
"madge": "6.1.0",
"minimist": "1.2.8",
"resedit": "2.0.0",
"ts-node-dev": "2.0.0",
"tsconfig-paths": "4.2.0",
"typedoc": "0.25.4",
"typemoq": "2.1.0",
"vitest": "1.1.0"
"@biomejs/biome": "~1.6",
"@pnpm/exe": "8.15.4",
"@swc/cli": "~0.3",
"@swc/core": "~1.4",
"@types/i18n": "~0.13",
"@types/node": "~20.11",
"@types/proper-lockfile": "~4.1",
"@types/semver": "~7.5",
"@types/ws": "~8.5",
"@typescript-eslint/eslint-plugin": "~7.2",
"@typescript-eslint/parser": "~7.2",
"@vitest/coverage-istanbul": "~1.3",
"@vitest/ui": "~1.3",
"@yao-pkg/pkg": "5.11.5",
"@yao-pkg/pkg-fetch": "3.5.9",
"cross-env": "~7.0",
"dprint": "~0.45",
"eslint": "~8.57",
"fs-extra": "~11.2",
"gulp": "~4.0",
"gulp-decompress": "~3.0",
"gulp-download": "~0.0.1",
"gulp-execa": "~6.0",
"gulp-rename": "~2.0",
"madge": "~6.1",
"minimist": "~1.2",
"resedit": "~2.0",
"ts-node-dev": "~2.0",
"tsconfig-paths": "~4.2",
"typedoc": "~0.25",
"typemoq": "~2.1",
"vitest": "~1.3"
},
"targets": {
"default": {

View File

@ -2,6 +2,7 @@ import crypto from "node:crypto";
import fs from "node:fs";
import { promisify } from "node:util";
import winston, { createLogger, format, transports } from "winston";
// eslint-disable-next-line @typescript-eslint/naming-convention
import DailyRotateFile from "winston-daily-rotate-file";
import { Daum } from "@spt-aki/models/eft/itemEvent/IItemEventRouterRequest";