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

83 Commits

Author SHA1 Message Date
Chomp
4baab4e3f5 Relocated typescript dep to be under dependencies 2025-01-13 23:40:22 +00:00
c334855919
Removes Typedoc (#1063)
### This depends on #1062

Actual changes in f940ac72b24951fae5abcf548e0a3d4c77640730

---------

Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
2025-01-09 21:54:12 +00:00
a821f1caba
Pins NPM Packages (#1062)
We can't commit our npm lockfile, so this should help lock things down.
2025-01-09 21:53:00 +00:00
73ebeca095
Removes date-fns
Removes `date-fns` dependency and replace date formatting with custom implementation.
2025-01-09 15:54:31 -05:00
17a614aa03
Removes PNPM Feature (#1060)
Removes the auto-install mod dependencies feature, the related messages,
and the configuration option.

Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
2025-01-09 20:29:28 +00:00
6be6d9099c
Removes buffer-crc32 (#1058)
Remove `buffer-crc32` dependency and use `crc32` from `node:zlib`.

Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
2025-01-09 20:28:33 +00:00
56c13e9d3f
Replace json-fixer with jsonrepair for improved JSON validation 2025-01-09 09:59:13 -05:00
9c17464ae3
File System (#1050)
This adds the `FileSystem` and `FileSystemSync` classes to replace the
VFS class. These classes handle file system operations using `fs-extra`
for most tasks, except where the `atomically` package can be used to
improve reads and writes. The goal is to ensure that file operations are
as safe as possible while still providing a comfortable API. File
operation atomicity is focused on single files, as there's no trivial,
strict way to ensure atomicity for directory operations.

## Changes
- Adds `FileSystem` class for asynchronous file operations
- Adds `FileSystemSync` class for synchronous file operations
- Updates `atomically` to `2.0.3`
- Updates build script to transpiles ESM modules
- Resolves `AbstractWinstonLogger` bug that could cause a log file to be
overwritten
- Removes `VFS` class
- Removes `AsyncQueue` class
- Removes `proper-lockfile` package

## TODO

- Test anything that touches a file.

I'm leaving this in a draft state until I can test this further. Help is
more than welcome at this point. The classes are pretty solid, but
ensuring that they're being used properly throughout the existing code
still needs work.

---------

Co-authored-by: Chomp <dev@dev.sp-tarkov.com>
2025-01-09 10:50:39 +00:00
Chomp
52aba88e49 Removed unused script 2025-01-09 10:05:23 +00:00
c5277177c3
Type Check Before Debug
This updates the npm debug command to type check before executing the run entry. If the check fails the debug will not continue.
2025-01-07 19:33:28 -05:00
24dbcf2e20
Updates SWC & Moves to ESNext
Also removes some `.swcrc` options that are already the defaults.
2025-01-07 11:46:04 -05:00
7190557805
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>
2025-01-07 15:36:08 +00:00
ed2b90fa0a
Various fixes so biome is happy (#1032)
- Changes to import typing for ILogger and ICloner
- Targets es2022 in compilerOptions (Matching the target in .swcrc)
because otherwise Biome doesn't seem to find a proper target.
- Fixes up the seasonal event typing
- fixes run:debug to target the correct file
2025-01-06 17:09:33 +00:00
Chomp
7681d07ab9 Added new command to hydrate customisationStorage data 2025-01-05 15:27:27 +00:00
dbed08a747
Static Program Properties & Simplified Entry Points (#1010)
Significant refactoring of globals and entry points. Oh my.

- The global variables previously accessible throughout the codebase
have been restructured as private static properties of the Program
class. Public static getter methods have been added to allow read access
to these properties throughout the codebase.
- Entry points, which were dispersed across multiple files, have been
consolidated and simplified into a static method on the Program class,
making the entry logic easier to follow.
- Removed unnecessary ~~globals~~ Program static properties.
- Adjusted imports and references across the codebase to reflect the new
structure.

Try not to focus on the `gulpfile.mjs` changes, as it won't be around
for much longer. *[winky face]*

Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
2024-12-31 10:11:08 +00:00
4afc2f5c96
Development Strict Mode (#1006)
- Enables TS strict mode
- Adds script to check types
- Adds workflow to run check-type script
- Updates the code-checking workflows to share the same set-up job

This updates the `tsconfig.json` option to enable strict mode.
*However*, we use TSX for development and SWC for release, which do not
type-check, so this option only gives additional linting/visual-feedback
in VSCode.

Additionally, I've added a NPM script `npm run lint:types` and a GitHub
workflow that runs it.

**This depends on #1005.**

---------

Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
2024-12-30 09:13:15 +00:00
995a3d0c5a
Updates to Node v22.12.0 LTS (#1005)
- Updates version numbers in `.nvmrc`, `package.json`, and
`Server.code-workspace`
- Updates `@yao-pkg/pkg`, `@yao-pkg/pkg-fetch`, and `@types/node` to
latest
- Updates JSON import to FS read operation in `gulpfile.mjs`
- Updates node build target in `gulpfile.mjs`

Tested with local runs, Windows builds, and Linux builds. Have not
tested a Windows build on Linux, but see no reason it wouldn't work.
*[knocks on wood]*

I feel this is safe to merge.
2024-12-30 09:01:11 +00:00
9aadae00e9
TSX Support (#1004)
- Adds support for `tsx`
- Drops support for `ts-node`, `ts-node-dev`, and `tsconfig-paths`
- Changed workspace debug configuration to use `tsx` in watch mode
- Changed `npm run run:debug` command from using gulp to running `tsx`
directly (not in watch mode)
- Changed TypeScript settings for improved module handling
- Changed TypeScript to be a development dependency

Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
2024-12-29 21:01:50 +00:00
653b9723b8
Vitest Updates (#985)
Includes updates to Vitest dependencies, a small bug fix, and a
configuration change. All three of which were throwing warnings when the
test suite was ran.

### Dependency Updates:
*
[`project/package.json`](diffhunk://#diff-18e5b8a4dad7b1ed0da6b50ed507b3ab8116e07a8e44abd959a28261878d021fL69-R70):
Updated `@vitest/coverage-istanbul` and `@vitest/ui` to version `^2.1.8`
and added `vitest` dependency.
[[1]](diffhunk://#diff-18e5b8a4dad7b1ed0da6b50ed507b3ab8116e07a8e44abd959a28261878d021fL69-R70)
[[2]](diffhunk://#diff-18e5b8a4dad7b1ed0da6b50ed507b3ab8116e07a8e44abd959a28261878d021fL84-R85)

### Bug Fix:
*
[`project/src/controllers/RepeatableQuestController.ts`](diffhunk://#diff-92e6bd4234ed3c13309eb9bd27437f0933e58dedee51544e9b017b57c2a3c51cL581-R581):
Fixed a bug in the charisma bonus calculation for the `cost.count`
value.

### Configuration Changes:
*
[`project/tests/CustomEnvironment.ts`](diffhunk://#diff-79780538b7a90a5f7befb22838a460f65e3e0bce53d3685f36ed2b74894246a0L9-R9):
Updated the import path for `Environment` from `vitest`.
*
[`project/vitest.config.mts`](diffhunk://#diff-18152746ad4df10b798ca21a09c321bc8ad4adc393ebc6a26016a524203e599cR5-L10):
Added `cacheDir` configuration and renamed the file from
`vitest.config.ts`.
2024-12-16 22:12:30 +00:00
41d5bd5586
Updates Version Numbers 2024-12-15 23:27:30 -05:00
6501958e51
Version Number & Biome Format
Updates the version number in the package.json file.
Ran the Biome formatter.
2024-12-15 22:34:34 -05:00
ef14ad27e1
Profile Backups (#983)
Here's a jumping off point for the profile backup feature. Included some
basic configuration options. Currently backup runs on server start-up
(before the profiles are loaded into memory) and on a configurable
interval.

I think it still needs work.
- [x] The folder name dates should be used to detect which old backups
should be removed
- [x] Not sure about the interval implementation...
- [x] Could make the clean method thinner
- [x] Remove VFS; I don't believe it's needed for copy operations
- [x] Save a list of active mods used by the backed up profiles

---------

Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
Co-authored-by: Chomp <dev@dev.sp-tarkov.com>
2024-12-14 10:20:45 +00:00
be88a2224e
Merge branch '3.10.2-dev' 2024-12-07 13:52:24 -05:00
6c9e4fd0bb
Custom LFS Sever (#970)
We've created our own Git Large File Storage (LFS) server due to the
excessive cost of GitHub's bandwidth. Did you know all of their Ethernet
cables are actually gold coated diamonds?

This PR reverses the work done in #954 to compress large location JSON
files into a 7zip archive and handle the (de)compression of the archive.

Only JSON files within the `project/assets/database/` directory that are
larger than 5MB have been included in LFS. This translates to all of the
`looseLoot.json` files. The rest are small enough to be included in the
base repo.

A `.lfsconfig` file has been added to the root of the project to alert
git to the presence of the custom LFS server. This public server is
read-only. Write access is only available to developers within the
Single Player Tarkov GitHub organization.

<img
src="https://github.com/user-attachments/assets/7ddfec9b-5a9a-42e6-806d-fd419e4eaa4f"
width="250">
2024-12-06 13:56:05 +00:00
Chomp
ad41c249b8 Merge branch '3.10.1-dev' 2024-12-01 10:22:36 +00:00
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
DrakiaXYZ
53408dfc2a Target logform 2.6 specifically, as 2.7 included a breaking change 2024-11-27 12:31:01 -08:00
9b17a9b350 Create new script for associating productions with quests (!421)
See `src\tools\ProductionQuestsGen\ProductionQuestsGen.ts` for usage

I've run the tool and committed the updated production.json as an example of it successfully managing to find the quest association for most productions (Aside from new event quest productions)

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: SPT/Server#421
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
2024-11-02 09:37:59 +00:00
4851784626 Remove dependency on vitest, seems to be referenced by other dependencies (!410)
Referencing vitest directly causes `npm install` to fail for fresh installs, removing this allows it to install all dependencies successfully.

Reviewed-on: SPT/Server#410
Co-authored-by: Archangel <jesse@archangel.wtf>
Co-committed-by: Archangel <jesse@archangel.wtf>
2024-09-20 13:33:48 +00:00
Dev
532491bc91 Updated packages 2024-08-01 09:17:24 +01:00
静穏靄
45b29731dc Bump server version (!392)
Got confused when I generated types, this fixes NPM reporting 3.9.0.
Before and after:

![image](/attachments/056fdd66-c98f-4be3-bcb2-c3b4cfc5bd01)

Reviewed-on: SPT/Server#392
Co-authored-by: 静穏靄 <seionmoya@noreply.dev.sp-tarkov.com>
Co-committed-by: 静穏靄 <seionmoya@noreply.dev.sp-tarkov.com>
2024-08-01 07:12:28 +00:00
ed8dbbd195 Adds Biome - Removes ESLint & Prettier (!383)
Boogidy, boogidy, boogidy. Let's go racing! 🏎️

Removes the over-complicated and super-slow setup we had with ESLint & Prettier in favour of Biome. The largest change with the formatting is moving from Allman braces to 1TBS braces. Other than that, it's *pretty much* the same. Ah, and that Biome runs formatting and linting on the entire project about x10 faster than the old system ran formatting on one file. Seriously, the guy who came up with that last solution should be fired. :runs:

I've kept all of the formatting and linting commands the same as before, with the main mamma-jamma being: `npm run format`, which applies formatting and linting changes to the entire project.

Formatting-on-save works (quickly!) by (1) ensuring that you're working within the VSC workspace (as you should be), and (2) have the recommended Biome VSC extension installed. The link to the Biome extension is in the README.

This limits our options on code formatting going forward; Biome, like prettier, is very opinionated with very few formatting options available. But I see this as a good thing. I'd rather spend my time arguing about which gun in Tarkov is the best, rather than coding brace styles...

...It's the TOZ, and it always will be. Don't DM me.

Co-authored-by: chomp <chomp@noreply.dev.sp-tarkov.com>
Reviewed-on: SPT/Server#383
Co-authored-by: Refringe <me@refringe.com>
Co-committed-by: Refringe <me@refringe.com>
2024-07-22 21:15:57 +00:00
85bef99608 removed null style check that was slowing down file processing (!381)
Co-authored-by: clodan <clodan@clodan.com>
Reviewed-on: SPT/Server#381
Co-authored-by: Alex <clodan@noreply.dev.sp-tarkov.com>
Co-committed-by: Alex <clodan@noreply.dev.sp-tarkov.com>
(cherry picked from commit 130b12879e4bbc4e9b11b4d6d38bafda7a21df5a)
2024-07-21 15:19:54 +01:00
Dev
2941ae10e0 Implemented mongoid-js for hashUtil.generate() 2024-07-08 21:11:58 +01:00
edfe995c52 Initial implementation of an ItemTpl and Weapon enum generator (!364)
ItemTplGenerator will create a full ItemTpl.ts and Weapons.ts file with all items and weapons respectively
Renamed WeaponTypes to Weapons to better indicate its new format
Updated all references to these enums to use the new names
New npm command `npm run gen:items` to run this tool

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: SPT/Server#364
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
2024-06-16 08:33:01 +00:00
Dev
59fd030c98 Revert "Updated server node version to 20.14.0 from 20.11.1"
This reverts commit f672ad27bfc1b001e94867fffe8ad5da2d051712.
2024-06-03 17:34:22 +01:00
Dev
f672ad27bf Updated server node version to 20.14.0 from 20.11.1 2024-06-03 15:50:27 +01:00
Dev
dcf816702e Updated various node packages 2024-06-03 15:44:40 +01:00
1bf520a044 Added null checks as warnings (!352)
Co-authored-by: clodan <clodan@clodan.com>
Reviewed-on: SPT/Server#352
Co-authored-by: Alex <clodan@noreply.dev.sp-tarkov.com>
Co-committed-by: Alex <clodan@noreply.dev.sp-tarkov.com>
2024-05-27 13:08:21 +00:00
d13e86ba46 Rebranding to SPT (!345)
Rebranded src code and scripts to SPT

Co-authored-by: clodan <clodan@clodan.com>
Reviewed-on: SPT-AKI/Server#345
Co-authored-by: Alex <clodan@noreply.dev.sp-tarkov.com>
Co-committed-by: Alex <clodan@noreply.dev.sp-tarkov.com>
2024-05-21 17:59:04 +00:00
5b5bf8bd7c Added WebSocket handlers for new connections and messages received through the default EFT socket (!339)
Co-authored-by: clodan <clodan@clodan.com>
Reviewed-on: SPT-AKI/Server#339
Co-authored-by: Alex <clodan@noreply.dev.sp-tarkov.com>
Co-committed-by: Alex <clodan@noreply.dev.sp-tarkov.com>
2024-05-18 16:45:21 +00:00
79781ab8bb Linting Updates (!336)
This update now runs Prettier before ESLint (with the Stylistic plugin) for code formatting. This takes care of a lot of the edge cases that ESLint doesn't touch by itself. Also adds the `eslint-plugin-unused-imports` ESLint plugin to remove unused imports and the `eslint-plugin-switch-allman` ESLint plugin to enforce Allman braces on case declarations.

The VSCode format-on-save function now requires two additional extentions to be installed: Prettier and Format Code Action. Links can be found in the README and in the recommended extentions section of VSCode when the workspace is open.

Co-authored-by: chomp <chomp@noreply.dev.sp-tarkov.com>
Reviewed-on: SPT-AKI/Server#336
Co-authored-by: Refringe <me@refringe.com>
Co-committed-by: Refringe <me@refringe.com>
2024-05-16 08:41:05 +00:00
ba1ac09b0b
Merge branch '3.8.2-DEV' into 3.9.0-DEV
# Conflicts:
#	project/src/callbacks/ItemEventCallbacks.ts
#	project/src/models/eft/common/IGlobals.ts
#	project/src/models/eft/common/ILocation.ts
#	project/src/models/eft/common/ILocationBase.ts
#	project/src/models/eft/common/tables/ILootBase.ts
#	project/src/models/eft/common/tables/ITemplateItem.ts
#	project/src/models/eft/weather/IWeatherData.ts
#	project/src/models/spt/bots/BotGenerationDetails.ts
#	project/src/models/spt/config/IPmcConfig.ts
#	project/src/models/spt/config/IWeatherConfig.ts
#	project/src/models/spt/server/IDatabaseTables.ts
#	project/src/models/spt/server/ILocations.ts
#	project/src/servers/http/IHttpListener.ts
2024-05-08 00:21:12 -04:00
e8b47bf733
ESLint Configuration Format & Import Sorting
The built-in ESLint import settings will lint the imports, but not fix them, as that's concidered stylistic. The ESLint Stylistic package doesn't currently support sorting. We have to use the ESLint Import plugin to force import sorting. This Import plugin doesn't yet support the new ESLint flat-configuration file format so we've had to convert back to the old no-flat format.
2024-05-07 14:26:54 -04:00
735624eb9c
Merge branch '3.8.2-DEV' into 3.9.0-DEV 2024-05-06 21:52:21 -04:00
6921f9363d
Code Styling Changes
- Drops DPrint
- Drops Biome
- Adds ESList Stylistic
- Updates ESLint config to new FlatConfig format
- Removed the `dprint.dprint` and `biomejs.biome` VSC extentions from the recommendations list
- Updates README to reflect all the above changes

TODO: Import sorting & minor fixes after `npm run lint:fix`.

Curse you, Alex!
2024-05-06 02:36:35 -04:00
84d5462955 Fixed give command to use dice coefficient making it more precise. Fixed give command giving invalid items to players. (!323)
Co-authored-by: clodan <clodan@clodan.com>
Reviewed-on: SPT-AKI/Server#323
Co-authored-by: Alex <clodan@noreply.dev.sp-tarkov.com>
Co-committed-by: Alex <clodan@noreply.dev.sp-tarkov.com>
2024-05-05 08:01:18 +00:00
Dev
509e208fb9 Merge branch '3.8.1-DEV' of https://dev.sp-tarkov.com/SPT-AKI/Server into 3.9.0-DEV
# Conflicts:
#	project/assets/configs/pmc.json
#	project/src/helpers/ItemHelper.ts
#	project/src/models/spt/config/IPmcConfig.ts
2024-05-04 21:41:44 +01:00
03c914f9e8 Fixed ragfair memory leak (!319)
Fixed ragfair memory leak where NPC player ids would continuously get added into the cache map, when those offers expire the entry on the dictionary would be left empty but the string allocation on the key would remain in memory, overtime it would stack up to massive amounts of memory usage

Co-authored-by: clodan <clodan@clodan.com>
Reviewed-on: SPT-AKI/Server#319
Co-authored-by: Alex <clodan@noreply.dev.sp-tarkov.com>
Co-committed-by: Alex <clodan@noreply.dev.sp-tarkov.com>
2024-05-02 13:18:34 +00:00
Dev
e3bb1932ff Fixed server type generation command not working 2024-04-21 16:23:39 +01:00