mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 02:10:44 -05:00
Biome Configuration Updates (#1042)
See 0d1e1ba3591458bb195812232d3b8c3345abbeaa for actual changes. The rest is from running the `style:fix` script. - Consolidated ignores - Enabled for `ModCompilerService.ts` - Added a format ignore line to `ModCompilerService.ts` to prevent mappings from being affected - Enabled for `jsonc` file types --------- Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
This commit is contained in:
parent
f1b1dd46eb
commit
7190557805
@ -11,6 +11,9 @@
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports.biome": "explicit",
|
||||
"quickfix.biome": "explicit"
|
||||
},
|
||||
"[jsonc]": {
|
||||
"editor.defaultFormatter": "biomejs.biome"
|
||||
}
|
||||
},
|
||||
"extensions": {
|
||||
@ -31,16 +34,10 @@
|
||||
"runtimeVersion": "22.12.0",
|
||||
"runtimeExecutable": "tsx",
|
||||
"request": "launch",
|
||||
"runtimeArgs": [
|
||||
"watch",
|
||||
"--clear-screen=false"
|
||||
],
|
||||
"runtimeArgs": ["watch", "--clear-screen=false"],
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**",
|
||||
"${workspaceFolder}/node_modules/**",
|
||||
],
|
||||
"skipFiles": ["<node_internals>/**", "${workspaceFolder}/node_modules/**"]
|
||||
},
|
||||
{
|
||||
"name": "Run Vitest Tests",
|
||||
@ -48,16 +45,10 @@
|
||||
"runtimeVersion": "22.12.0",
|
||||
"runtimeExecutable": "npm",
|
||||
"request": "launch",
|
||||
"runtimeArgs": [
|
||||
"run",
|
||||
"test"
|
||||
],
|
||||
"runtimeArgs": ["run", "test"],
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**",
|
||||
"${workspaceFolder}/node_modules/**",
|
||||
],
|
||||
"skipFiles": ["<node_internals>/**", "${workspaceFolder}/node_modules/**"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -8523,7 +8523,8 @@
|
||||
"maxToSendPlayer": 5
|
||||
},
|
||||
"NewYear2024": {
|
||||
"items": [{
|
||||
"items": [
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ec3",
|
||||
"_tpl": "67124dcfa3541f2a1f0e788b",
|
||||
"upd": {
|
||||
@ -8537,37 +8538,44 @@
|
||||
},
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ec4",
|
||||
"_tpl": "6719023b612cc94b9008e78c",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec3",
|
||||
"slotId": "mod_stock"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ec5",
|
||||
"_tpl": "6709133fa532466d5403fb7c",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec3",
|
||||
"slotId": "mod_magazine"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ec6",
|
||||
"_tpl": "670fd0a8d8d4eae4790c8187",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec3",
|
||||
"slotId": "mod_barrel"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ec7",
|
||||
"_tpl": "6710cea62bb09af72f0e6bf8",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec6",
|
||||
"slotId": "mod_mount"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ec8",
|
||||
"_tpl": "57d17c5e2459775a5c57d17d",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec7",
|
||||
"slotId": "mod_tactical_003"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ec9",
|
||||
"_tpl": "6165ac8c290d254f5e6b2f6c",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec3",
|
||||
"slotId": "mod_scope"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ecb",
|
||||
"_tpl": "6709133fa532466d5403fb7c",
|
||||
"upd": {
|
||||
@ -8575,7 +8583,8 @@
|
||||
},
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ecd",
|
||||
"_tpl": "6709133fa532466d5403fb7c",
|
||||
"upd": {
|
||||
@ -8583,7 +8592,8 @@
|
||||
},
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ecf",
|
||||
"_tpl": "6709133fa532466d5403fb7c",
|
||||
"upd": {
|
||||
@ -8591,7 +8601,8 @@
|
||||
},
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ed1",
|
||||
"_tpl": "5c0d591486f7744c505b416f",
|
||||
"upd": {
|
||||
@ -8599,7 +8610,8 @@
|
||||
},
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ed3",
|
||||
"_tpl": "5c0d591486f7744c505b416f",
|
||||
"upd": {
|
||||
@ -8607,7 +8619,8 @@
|
||||
},
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ed5",
|
||||
"_tpl": "5c0d591486f7744c505b416f",
|
||||
"upd": {
|
||||
@ -8615,62 +8628,74 @@
|
||||
},
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ed6",
|
||||
"_tpl": "5ab8e79e86f7742d8b372e78",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ed7",
|
||||
"_tpl": "65732688d9d89ff7ac0d9c4c",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ed6",
|
||||
"slotId": "Soft_armor_front"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ed8",
|
||||
"_tpl": "657326978c1cc6dcd9098b56",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ed6",
|
||||
"slotId": "Soft_armor_back"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ed9",
|
||||
"_tpl": "657326a28c1cc6dcd9098b5a",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ed6",
|
||||
"slotId": "Soft_armor_left"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7eda",
|
||||
"_tpl": "657326b08c1cc6dcd9098b5e",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ed6",
|
||||
"slotId": "soft_armor_right"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7edb",
|
||||
"_tpl": "657326bc5d3a3129fb05f36b",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ed6",
|
||||
"slotId": "Collar"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7edc",
|
||||
"_tpl": "656f611f94b480b8a500c0db",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ed6",
|
||||
"slotId": "Front_plate"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7edd",
|
||||
"_tpl": "65573fa5655447403702a816",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ed6",
|
||||
"slotId": "Back_plate"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ede",
|
||||
"_tpl": "675956062f6ddfe8ff0e2806",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7edf",
|
||||
"_tpl": "676307c004856a0b3c0dfffd",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ede",
|
||||
"slotId": "Helmet_top"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ee0",
|
||||
"_tpl": "676307b4d9ec0af3d9001fa8",
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ede",
|
||||
"slotId": "Helmet_back"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ee2",
|
||||
"_tpl": "674589d98dd67746010329e6",
|
||||
"upd": {
|
||||
@ -8678,7 +8703,8 @@
|
||||
},
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ee4",
|
||||
"_tpl": "67458794e21e5d724e066976",
|
||||
"upd": {
|
||||
@ -8686,7 +8712,8 @@
|
||||
},
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ee6",
|
||||
"_tpl": "5d40407c86f774318526545a",
|
||||
"upd": {
|
||||
@ -8694,7 +8721,8 @@
|
||||
},
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7ee8",
|
||||
"_tpl": "5d40407c86f774318526545a",
|
||||
"upd": {
|
||||
@ -8702,7 +8730,8 @@
|
||||
},
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7eea",
|
||||
"_tpl": "5d403f9186f7743cac3f229b",
|
||||
"upd": {
|
||||
@ -8710,7 +8739,8 @@
|
||||
},
|
||||
"parentId": "6773b39ccf4c2fe4e50a7ec2",
|
||||
"slotId": "main"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"_id": "6773b39ccf4c2fe4e50a7eec",
|
||||
"_tpl": "5d403f9186f7743cac3f229b",
|
||||
"upd": {
|
||||
|
@ -1411,7 +1411,7 @@
|
||||
"_type": "opened case - walter event quest",
|
||||
"rewardCount": 4,
|
||||
"foundInRaid": true,
|
||||
"rewardTplPool": {"67409848d0b2f8eb9b034db9": 1}
|
||||
"rewardTplPool": { "67409848d0b2f8eb9b034db9": 1 }
|
||||
},
|
||||
"674098588466ebb03408b210": {
|
||||
"_type": "opened box - walter event quest",
|
||||
|
@ -800,10 +800,12 @@
|
||||
"followerBoarClose2"
|
||||
],
|
||||
"additionalFriendlyTypes": ["gifter", "shooterBTR", "sectactPriestEvent", "peacefullZryachiyEvent"],
|
||||
"chancedEnemies": [{
|
||||
"chancedEnemies": [
|
||||
{
|
||||
"EnemyChance": 85,
|
||||
"Role": "pmcUSEC"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"EnemyChance": 100,
|
||||
"Role": "pmcBEAR"
|
||||
}
|
||||
@ -843,10 +845,12 @@
|
||||
"followerBoarClose2"
|
||||
],
|
||||
"additionalFriendlyTypes": ["gifter", "shooterBTR", "sectactPriestEvent", "peacefullZryachiyEvent"],
|
||||
"chancedEnemies": [{
|
||||
"chancedEnemies": [
|
||||
{
|
||||
"EnemyChance": 85,
|
||||
"Role": "pmcBEAR"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"EnemyChance": 100,
|
||||
"Role": "pmcUSEC"
|
||||
}
|
||||
|
@ -337,7 +337,7 @@
|
||||
"newPriceHandbookMultiplier": 11
|
||||
}
|
||||
},
|
||||
"itemPriceOverrideRouble":{
|
||||
"itemPriceOverrideRouble": {
|
||||
"66bc98a01a47be227a5e956e": 500000,
|
||||
"63a8970d7108f713591149f5": 50000,
|
||||
"63a898a328e385334e0640a5": 100000,
|
||||
|
@ -97,56 +97,64 @@
|
||||
"weights": [1, 2]
|
||||
}
|
||||
},
|
||||
"seasonDates": [{
|
||||
"seasonDates": [
|
||||
{
|
||||
"seasonType": 0,
|
||||
"name": "SUMMER",
|
||||
"startDay": "2",
|
||||
"startMonth": "6",
|
||||
"endDay": "15",
|
||||
"endMonth": "10"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"seasonType": 1,
|
||||
"name": "AUTUMN",
|
||||
"startDay": "15",
|
||||
"startMonth": "10",
|
||||
"endDay": "1",
|
||||
"endMonth": "11"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"seasonType": 4,
|
||||
"name": "AUTUMN_LATE",
|
||||
"startDay": "1",
|
||||
"startMonth": "11",
|
||||
"endDay": "21",
|
||||
"endMonth": "12"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"seasonType": 2,
|
||||
"name": "WINTER_START",
|
||||
"startDay": "21",
|
||||
"startMonth": "12",
|
||||
"endDay": "31",
|
||||
"endMonth": "12"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"seasonType": 2,
|
||||
"name": "WINTER_END",
|
||||
"startDay": "1",
|
||||
"startMonth": "1",
|
||||
"endDay": "9",
|
||||
"endMonth": "1"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"seasonType": 5,
|
||||
"name": "SPRING_EARLY",
|
||||
"startDay": "9",
|
||||
"startMonth": "1",
|
||||
"endDay": "25",
|
||||
"endMonth": "3"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"seasonType": 3,
|
||||
"name": "SPRING",
|
||||
"startDay": "25",
|
||||
"startMonth": "3",
|
||||
"endDay": "2",
|
||||
"endMonth": "6"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"seasonType": 4,
|
||||
"name": "STORM",
|
||||
"startDay": "24",
|
||||
|
@ -8,24 +8,23 @@
|
||||
".editorconfig",
|
||||
".git/*",
|
||||
".pkg-cache/*",
|
||||
".vscode/*",
|
||||
"assets/database/*",
|
||||
"build/*",
|
||||
"node_modules/*",
|
||||
"obj/*",
|
||||
"out/*",
|
||||
"src/services/ModCompilerService.ts",
|
||||
"tests/__cache__/*",
|
||||
"tests/__coverage__/*",
|
||||
"types/*",
|
||||
"user/mods/*",
|
||||
"user/profiles/*",
|
||||
"assets/database/*"
|
||||
"user/*"
|
||||
]
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true,
|
||||
"suspicious": {
|
||||
"noExplicitAny": "warn"
|
||||
},
|
||||
"style": {
|
||||
"useImportType": "off"
|
||||
}
|
||||
@ -34,17 +33,6 @@
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"formatWithErrors": false,
|
||||
"ignore": [
|
||||
"**/.git",
|
||||
"**/.pkg-cache",
|
||||
"**/.vscode",
|
||||
"**/build",
|
||||
"**/node_modules",
|
||||
"**/types",
|
||||
"**/tests/__cache__",
|
||||
"**/tests/__coverage__",
|
||||
"**/.editorconfig"
|
||||
],
|
||||
"attributePosition": "auto",
|
||||
"indentStyle": "space",
|
||||
"indentWidth": 4,
|
||||
@ -72,14 +60,7 @@
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"include": ["tests/*"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"suspicious": {
|
||||
"noExplicitAny": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
"include": ["tests/*"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ export class RagfairController {
|
||||
|
||||
// Figure out how many items the requirementsCost is applying to, and what the per-item price is
|
||||
const offerItemCount = Math.max(
|
||||
offer.sellInOnePiece ? (offer.items[0].upd?.StackObjectsCount ?? 1) : 1,
|
||||
offer.sellInOnePiece ? offer.items[0].upd?.StackObjectsCount ?? 1 : 1,
|
||||
);
|
||||
const perItemPrice = offer.requirementsCost / offerItemCount;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
// This is an auto generated file, do not modify. Re-generate with `npm run gen:items`
|
||||
export enum ItemTpl
|
||||
{
|
||||
export enum ItemTpl {
|
||||
AMMOBOX_127X33_COPPER_20RND = "676009ddb623f3b8ba079419",
|
||||
AMMOBOX_127X33_FMJ_20RND = "676009ed8f1fee08740f9479",
|
||||
AMMOBOX_127X33_JHP_20RND = "676009fe8f1fee08740f947c",
|
||||
|
@ -1,6 +1,5 @@
|
||||
// This is an auto generated file, do not modify. Re-generate with `npm run gen:items`
|
||||
export enum Weapons
|
||||
{
|
||||
export enum Weapons {
|
||||
ASSAULTCARBINE_762X39_OP_SKS = "587e02ff24597743df3deaeb",
|
||||
ASSAULTCARBINE_762X39_SKS = "574d967124597745970e7c94",
|
||||
ASSAULTCARBINE_762X51_VPO_101_VEPR_HUNTER = "5c501a4d2e221602b412b540",
|
||||
|
@ -38,7 +38,7 @@ export interface ISeasonalEventSettings {
|
||||
enableSummoning: boolean;
|
||||
enableHalloweenHideout: boolean;
|
||||
enableChristmasHideout: boolean;
|
||||
enableSanta: boolean,
|
||||
enableSanta: boolean;
|
||||
adjustBotAppearances: boolean;
|
||||
addEventGearToBots: boolean;
|
||||
addEventLootToBots: boolean;
|
||||
|
@ -16,8 +16,8 @@ export class SPTWebSocket extends WebSocket {
|
||||
|
||||
public closeAsync(): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.on('close', () => resolve());
|
||||
this.on('error', (err) => reject(err));
|
||||
this.on("close", () => resolve());
|
||||
this.on("error", (err) => reject(err));
|
||||
this.close();
|
||||
});
|
||||
}
|
||||
|
@ -1,23 +1,21 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { inject, injectable } from "tsyringe";
|
||||
import { ScriptTarget, ModuleKind, ModuleResolutionKind, transpileModule, CompilerOptions } from "typescript";
|
||||
import { ProgramStatics } from "@spt/ProgramStatics";
|
||||
import type { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ModHashCacheService } from "@spt/services/cache/ModHashCacheService";
|
||||
import { VFS } from "@spt/utils/VFS";
|
||||
import { inject, injectable } from "tsyringe";
|
||||
import { CompilerOptions, ModuleKind, ModuleResolutionKind, ScriptTarget, transpileModule } from "typescript";
|
||||
|
||||
@injectable()
|
||||
export class ModCompilerService
|
||||
{
|
||||
export class ModCompilerService {
|
||||
protected serverDependencies: string[];
|
||||
|
||||
constructor(
|
||||
@inject("PrimaryLogger") protected logger: ILogger,
|
||||
@inject("ModHashCacheService") protected modHashCacheService: ModHashCacheService,
|
||||
@inject("VFS") protected vfs: VFS,
|
||||
)
|
||||
{
|
||||
) {
|
||||
const packageJsonPath: string = path.join(__dirname, "../../package.json");
|
||||
this.serverDependencies = Object.keys(JSON.parse(this.vfs.readFile(packageJsonPath)).dependencies);
|
||||
}
|
||||
@ -29,33 +27,28 @@ export class ModCompilerService
|
||||
* @param modTypeScriptFiles
|
||||
* @returns
|
||||
*/
|
||||
public async compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise<void>
|
||||
{
|
||||
public async compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise<void> {
|
||||
// Concatenate TS files into one string
|
||||
let tsFileContents = "";
|
||||
let fileExists = true; // does every js file exist (been compiled before)
|
||||
for (const file of modTypeScriptFiles)
|
||||
{
|
||||
for (const file of modTypeScriptFiles) {
|
||||
const fileContent = this.vfs.readFile(file);
|
||||
tsFileContents += fileContent;
|
||||
|
||||
// Does equivalent .js file exist
|
||||
if (!this.vfs.exists(file.replace(".ts", ".js")))
|
||||
{
|
||||
if (!this.vfs.exists(file.replace(".ts", ".js"))) {
|
||||
fileExists = false;
|
||||
}
|
||||
}
|
||||
|
||||
const hashMatches = this.modHashCacheService.calculateAndCompareHash(modName, tsFileContents);
|
||||
|
||||
if (fileExists && hashMatches)
|
||||
{
|
||||
if (fileExists && hashMatches) {
|
||||
// Everything exists and matches, escape early
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hashMatches)
|
||||
{
|
||||
if (!hashMatches) {
|
||||
// Store / update hash in json file
|
||||
this.modHashCacheService.calculateAndStoreHash(modName, tsFileContents);
|
||||
}
|
||||
@ -82,13 +75,11 @@ export class ModCompilerService
|
||||
* @param fileNames Paths to TS files
|
||||
* @param options Compiler options
|
||||
*/
|
||||
protected async compile(fileNames: string[], options: CompilerOptions): Promise<void>
|
||||
{
|
||||
protected async compile(fileNames: string[], options: CompilerOptions): Promise<void> {
|
||||
// C:/snapshot/project || /snapshot/project
|
||||
const baseDir: string = __dirname.replace(/\\/g, "/").split("/").slice(0, 3).join("/");
|
||||
|
||||
for (const filePath of fileNames)
|
||||
{
|
||||
for (const filePath of fileNames) {
|
||||
const destPath = filePath.replace(".ts", ".js");
|
||||
const parsedPath = path.parse(filePath);
|
||||
const parsedDestPath = path.parse(destPath);
|
||||
@ -97,20 +88,17 @@ export class ModCompilerService
|
||||
|
||||
if (ProgramStatics.COMPILED) {
|
||||
replacedText = text.replace(/(@spt)/g, `${baseDir}/obj`);
|
||||
for (const dependency of this.serverDependencies)
|
||||
{
|
||||
for (const dependency of this.serverDependencies) {
|
||||
replacedText = replacedText.replace(`"${dependency}"`, `"${baseDir}/node_modules/${dependency}"`);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
replacedText = text.replace(/(@spt)/g, path.join(__dirname, "..").replace(/\\/g, "/"));
|
||||
}
|
||||
|
||||
const output = transpileModule(replacedText, { compilerOptions: options });
|
||||
|
||||
if (output.sourceMapText)
|
||||
{
|
||||
if (output.sourceMapText) {
|
||||
// biome-ignore format: these mappings should not be formatted
|
||||
output.outputText = output.outputText.replace(
|
||||
"//# sourceMappingURL\=module.js.map",
|
||||
`//# sourceMappingURL\=${parsedDestPath.base}.map`,
|
||||
@ -125,8 +113,7 @@ export class ModCompilerService
|
||||
fs.writeFileSync(destPath, output.outputText);
|
||||
}
|
||||
|
||||
while (!this.areFilesReady(fileNames))
|
||||
{
|
||||
while (!this.areFilesReady(fileNames)) {
|
||||
await this.delay(200);
|
||||
}
|
||||
}
|
||||
@ -136,8 +123,7 @@ export class ModCompilerService
|
||||
* @param fileNames
|
||||
* @returns
|
||||
*/
|
||||
protected areFilesReady(fileNames: string[]): boolean
|
||||
{
|
||||
protected areFilesReady(fileNames: string[]): boolean {
|
||||
return fileNames.filter((x) => !this.vfs.exists(x.replace(".ts", ".js"))).length === 0;
|
||||
}
|
||||
|
||||
@ -146,8 +132,7 @@ export class ModCompilerService
|
||||
* @param ms Milliseconds
|
||||
* @returns
|
||||
*/
|
||||
protected delay(ms: number): Promise<unknown>
|
||||
{
|
||||
protected delay(ms: number): Promise<unknown> {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,12 @@ import { SeasonalEventType } from "@spt/models/enums/SeasonalEventType";
|
||||
import { IHttpConfig } from "@spt/models/spt/config/IHttpConfig";
|
||||
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
|
||||
import { IQuestConfig } from "@spt/models/spt/config/IQuestConfig";
|
||||
import { ISeasonalEvent, ISeasonalEventConfig, ISeasonalEventSettings, IZombieSettings } from "@spt/models/spt/config/ISeasonalEventConfig";
|
||||
import {
|
||||
ISeasonalEvent,
|
||||
ISeasonalEventConfig,
|
||||
ISeasonalEventSettings,
|
||||
IZombieSettings,
|
||||
} from "@spt/models/spt/config/ISeasonalEventConfig";
|
||||
import { IWeatherConfig } from "@spt/models/spt/config/IWeatherConfig";
|
||||
import type { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
|
@ -70,7 +70,8 @@ export class HideoutCustomisationGen {
|
||||
}
|
||||
|
||||
const matchingQuest = this.questCustomisationReward[questOrAchievementRequirement.target as string];
|
||||
const matchingAchievement = this.achievementCustomisationReward[questOrAchievementRequirement.target as string];
|
||||
const matchingAchievement =
|
||||
this.achievementCustomisationReward[questOrAchievementRequirement.target as string];
|
||||
|
||||
let source = null;
|
||||
if (matchingQuest) {
|
||||
|
@ -26,7 +26,7 @@ export default (<Environment>{
|
||||
await importDatabase(container);
|
||||
|
||||
return {
|
||||
async teardown() { },
|
||||
async teardown() {},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
@ -13,16 +13,9 @@
|
||||
"verbatimModuleSyntax": false,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@spt/*": [
|
||||
"./src/*"
|
||||
],
|
||||
"@tests/*": [
|
||||
"./tests/*"
|
||||
]
|
||||
"@spt/*": ["./src/*"],
|
||||
"@tests/*": ["./tests/*"]
|
||||
}
|
||||
},
|
||||
},
|
||||
"include": [
|
||||
"src/*",
|
||||
"src/**/*"
|
||||
]
|
||||
"include": ["src/*", "src/**/*"]
|
||||
}
|
||||
|
@ -7,7 +7,5 @@
|
||||
"declaration": true,
|
||||
"declarationDir": "./types"
|
||||
},
|
||||
"exclude": [
|
||||
"./types/**/*"
|
||||
]
|
||||
"exclude": ["./types/**/*"]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user