Skip to content

Commit

Permalink
BunJS Runtime, Updated Build System, and...
Browse files Browse the repository at this point in the history
This is a big one.

Changes:
- Targets next major release (v4.0.0)
- Switch runtimes from NodeJS to BunJS (bun.sh)
- Typescript library support moved to `ESNext`
- Typescript compile option `verbatimModuleSyntax` enabled
- ^ Updated all interfaces to be imported explicitly as types
- Strict mode enabled
- Reduces the number of tsconfig files
- Pins all dep packages to specific patch verions
- Includes Bun lock file in repo (doesn't cause issues like the package-lock did)
- Replaces Gulp with a new Typescript based build system
- Adds `core-js` as a workaround for Bun not playing nice with `reflect-metadata`
- Removes `pkg` and `swc` (Yay Bun!)
- Updated package scripts and entry point system to be more intuitive
- Updated VSCode workspace configurations
- Updated `.gitignore` to align with updated project structure
- Updated Biome configuration to align with updated project structure
- `Program.ts` - Removes call to set encoding on the process
- `global.d.ts` - Added underscores to build globals to match other global names
- `JsonUtil.ts` - Replaced old `fixJson` package with newer `jsonrepair` package
- `HashUtil.ts` - Replaced old `buffer-crc32` package with built-in `node:zlib` package
- `DatabaseImporter.ts` - Updates database validation object to be flat, where the keys are the relative path to the file
- `BunTimer.ts` - Adds an easy to use timer class that's compatible with nanoseconds.

TODO:
- Look into mod loading. I think we use a TS transpiler for mods and I believe that can be removed now.
- Bun includes a number of APIs that can be used in place of Node's packages (built-in or otherwise); HTTP server, WebSocket server, File IO, Hashing, File Globing, Testing... Each of these should be utilized where ever possible.
- Update in-repo documentation to reference BunJS instead of NodeJS.
  • Loading branch information
refringe committed Dec 21, 2024
1 parent ec5227a commit bc39ca4
Show file tree
Hide file tree
Showing 502 changed files with 3,687 additions and 2,593 deletions.
25 changes: 3 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
*.exe
*.zip
*.d.ts
project/build/
project/obj/
project/dist/
project/user/
project/logs/
project/SPT_Data/
project/tmp/
project/docs/
project/types/
project/tests/__cache__/
project/tests/__coverage__/
Expand All @@ -19,31 +15,16 @@ project/src/__coverage__/
.vs
.idea
.vscode
slnx.sqlite
slnx-journal.sqlite

# sqlite databases
*.sqlite

## nodejs
package-lock.json
node_modules
node.exe
pnpm-lock.yaml
yarn.lock

## windows
desktop.ini

## OSX
.DS_Store

## parcel
.parcel-cache/

## Pkg
.pkg-cache

## yarn
**/yarn-error.log

#jest
coverage
.scannerwork/
1 change: 0 additions & 1 deletion project/.nvmrc

This file was deleted.

31 changes: 0 additions & 31 deletions project/.swcrc

This file was deleted.

30 changes: 10 additions & 20 deletions project/Server.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,30 @@
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit",
"quickfix.biome": "explicit"
}
},
"bun.runtime": "bun",
"bun.debugTerminal.enabled": true,
},
"extensions": {
"recommendations": [
"EditorConfig.EditorConfig", // EditorConfig file support.
"vitest.explorer", // ViTest test runner.
"refringe.spt-id-highlighter", // SPT ID information of hover.
"biomejs.biome" // Biome code formatting, linting, and refactoring.
"biomejs.biome", // Biome code formatting, linting, and refactoring.
"oven.bun-vscode" // Additional Bun runtime support.
]
},
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "node",
"runtimeVersion": "20.11.1",
"runtimeExecutable": "npm",
"type": "bun",
"request": "launch",
"sourceMaps": true,
"runtimeArgs": ["run", "run:debug"],
"outFiles": ["!**/node_modules/**"],
"name": "Debug Bun",
"cwd": "${workspaceFolder}",
"outputCapture": "std"
},
{
"name": "Run Vitest Tests",
"type": "node",
"runtimeVersion": "20.11.1",
"runtimeExecutable": "npm",
"request": "launch",
"runtimeArgs": ["run", "test"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
"runtime": "bun",
"program": "src/ide/local.ts",
"watchMode": "hot"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion project/assets/configs/core.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sptVersion": "3.10.3",
"sptVersion": "4.0.0",
"projectName": "SPT",
"compatibleTarkovVersion": "0.15.5.33420",
"serverName": "SPT Server",
Expand Down
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "NENAHLAŠUJ TO",
"watermark-free_of_charge": "Tento produkt je zdarma",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "TATO VERZE MÁ ZÁKÁZÁNO MÓDOVÁNÍ SERVERU",
"watermark-no_support": "ŽÁDNÁ PODPORA NEBUDE POSKYTNUTA",
"watermark-not_an_issue": "TOTO NENÍ CHYBA",
Expand Down
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "MELDEN UNTERSAGT",
"watermark-free_of_charge": "Diese Arbeit ist kostenfrei",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "BEI DIESEM BUILD IST DAS SERVER-MODDING DEAKTIVIERT",
"watermark-no_support": "ES WIRD KEIN SUPPORT GEWÄHRT",
"watermark-not_an_issue": "DAS IST KEIN PROBLEM",
Expand Down
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "ΜΗΝ ΤΟ ΑΝΑΦΕΡΕΤΕ",
"watermark-free_of_charge": "Αυτή η εργασία είναι χωρίς χρέωση",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "ΑΥΤΗ Η ΕΚΔΟΣΗ ΕΧΕΙ ΑΠΕΝΕΡΓΟΠΟΙΗΜΈΝΕΣ ΤΙΣ ΤΡΟΠΟΠΟΙΗΣΕΙΣ ΑΠΟ ΤΟΝ ΔΙΑΚΟΜΙΣΤΗ",
"watermark-no_support": "ΔΕΝ ΘΑ ΔΩΘΕΙ ΥΠΟΣΤΗΡΙΞΗ",
"watermark-not_an_issue": "ΑΥΤΟ ΔΕΝ ΕΙΝΑΙ ΠΡΟΒΛΗΜΑ",
Expand Down
10 changes: 5 additions & 5 deletions project/assets/database/locales/server/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "DO NOT REPORT IT",
"watermark-free_of_charge": "This work is free of charge",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "THIS BUILD HAS SERVER MODDING DISABLED",
"watermark-no_support": "NO SUPPORT WILL BE GIVEN",
"watermark-not_an_issue": "THIS IS NOT AN ISSUE",
Expand All @@ -725,8 +725,8 @@
"websocket-received_message": "[WS] Received message from user %s ",
"websocket-socket_lost_deleting_handle": "[WS] Socket lost, deleting handle",
"websocket-started": "Started websocket at %s",
"chatbot-cannot_accept_any_more_of_gift": "You cannot accept any more of this gift",
"chatbot-halloween_event_enabled": "Halloween event has been enabled, restart your game client before starting a raid",
"chatbot-added_stash_rows_please_restart": "Added 2 rows to stash, please restart your game to see them",
"chatbot-snow_enabled": "Snow is enabled for all subsequent raids until the server is restarted"
"chatbot-cannot_accept_any_more_of_gift": "You cannot accept any more of this gift",
"chatbot-halloween_event_enabled": "Halloween event has been enabled, restart your game client before starting a raid",
"chatbot-added_stash_rows_please_restart": "Added 2 rows to stash, please restart your game to see them",
"chatbot-snow_enabled": "Snow is enabled for all subsequent raids until the server is restarted"
}
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/es-es.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "NO LO REPORTES",
"watermark-free_of_charge": "Este trabajo es libre de cargo.",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "ESTA VERSIÓN TIENE LAS MODIFICACIONES DESACTIVADAS",
"watermark-no_support": "NO SE DARÁ NINGÚN TIPO DE SOPORTE",
"watermark-not_an_issue": "ESTO NO ES UN PROBLEMA",
Expand Down
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "NE PAS SIGNALER !",
"watermark-free_of_charge": "Ce travail est gratuit",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "CE BUILD A LE MODDING DESACTIVE",
"watermark-no_support": "AUCUN SUPPORT NE SERA FOURNI",
"watermark-not_an_issue": "CECI N'EST PAS UNE ERREUR",
Expand Down
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "NON SEGNALARLO",
"watermark-free_of_charge": "Questo lavoro è gratuito",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "QUESTA BUILD HA LE MOD SERVER DISATTIVATE",
"watermark-no_support": "NESSUN SUPPORTO SARA' FORNITO",
"watermark-not_an_issue": "QUESTO NON É UN ERRORE",
Expand Down
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "리포트 하지마세요",
"watermark-free_of_charge": "이 소프트웨어는 무료입니다",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "이 버전은 모드가 비활성화된 빌드입니다",
"watermark-no_support": "문의 및 지원은 없습니다",
"watermark-not_an_issue": "이 메시지는 오류 또는 문제가 아닙니다",
Expand Down
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "RAPPORTEER HET NIET",
"watermark-free_of_charge": "Dit werk is gratis",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "DEZE BUILD HEEFT SERVER MODDEN UITGESCHAKELD",
"watermark-no_support": "ER WORDT GEEN SUPPORT GEGEVEN",
"watermark-not_an_issue": "DIT IS GEEN PROBLEEM",
Expand Down
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "NIE ZGŁASZAJ TEGO",
"watermark-free_of_charge": "Ta praca jest darmowa",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "TA WERSJA MA WYŁĄCZONE MODYFIKACJE SERWERA",
"watermark-no_support": "NIE UDZIELAMY WSPARCIA",
"watermark-not_an_issue": "TO NIE JEST PROBLEM",
Expand Down
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "NÃO RELATE ISSO",
"watermark-free_of_charge": "Esse trabalho é gratuito",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "ESTA VERSÃO TEM OS MODS DO SERVIDOR DESATIVADO",
"watermark-no_support": "NÃO SERÁ FORNECIDO NENHUM SUPORTE",
"watermark-not_an_issue": "ISSO NÃO É UM PROBLEMA",
Expand Down
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "НЕ ОТПРАВЛЯЙТЕ БАГ-РЕПОРТ НАСЧЕТ ЭТОГО",
"watermark-free_of_charge": "Данный проект является бесплатным",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "В ЭТОЙ СБОРКЕ ОТСУТСТВУЮТ ВОЗМОЖНОСТИ МОДИФИКАЦИИ",
"watermark-no_support": "ПОДДЕРЖКА НЕ БУДЕТ ОКАЗЫВАТЬСЯ",
"watermark-not_an_issue": "ЭТО НЕ ОШИБКА",
Expand Down
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "SAKIN BİLDİRMEYİN",
"watermark-free_of_charge": "Bu çalışma ücretsizdir",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "BU YAPIDA SUNUCU MODLAMASI DEVRE DIŞI BIRAKILMIŞTIR",
"watermark-no_support": "HİÇBİR DESTEK VERİLMEYECEK",
"watermark-not_an_issue": "BU BİR HATA DEĞİL",
Expand Down
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "НЕ ПОВІДОМЛЯЙТЕ ПРО ЦЕ",
"watermark-free_of_charge": "Ця робота бескоштовна ",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "У ЦОМУ БІЛДІ ВИМКНЕНО МОДИНГ СЕРВЕРА",
"watermark-no_support": "ЖОДНОЇ ПІДТРИМКИ НЕ БУДЕ НАДАНО",
"watermark-not_an_issue": "ЦЕ НЕ ПРОБЛЕМА",
Expand Down
2 changes: 1 addition & 1 deletion project/assets/database/locales/server/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
"watermark-discord_url": "https://discord.sp-tarkov.com",
"watermark-do_not_report": "不 要 报 告",
"watermark-free_of_charge": "该软件免费",
"watermark-issue_tracker_url": "https://dev.sp-tarkov.com/SPT/Server/issues",
"watermark-issue_tracker_url": "https://github.com/sp-tarkov/server/issues",
"watermark-modding_disabled": "该 编 译 不 启 用 服 务 端 模 改",
"watermark-no_support": "不 会 提 供 支 持",
"watermark-not_an_issue": "这 不 是 个 问 题",
Expand Down
35 changes: 5 additions & 30 deletions project/biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@
"ignore": [
".editorconfig",
".git/*",
".pkg-cache/*",
".vscode/*",
"build/*",
"assets/database/*",
"dist/*",
"node_modules/*",
"obj/*",
"out/*",
"src/services/ModCompilerService.ts",
"tests/__cache__/*",
"tests/__coverage__/*",
"types/*",
"user/mods/*",
"user/profiles/*",
"assets/database/*"
"user/profiles/*"
]
},
"linter": {
Expand All @@ -34,17 +31,7 @@
"formatter": {
"enabled": true,
"formatWithErrors": false,
"ignore": [
"**/.git",
"**/.pkg-cache",
"**/.vscode",
"**/build",
"**/node_modules",
"**/types",
"**/tests/__cache__",
"**/tests/__coverage__",
"**/.editorconfig"
],
"ignore": [],
"attributePosition": "auto",
"indentStyle": "space",
"indentWidth": 4,
Expand All @@ -69,17 +56,5 @@
"formatter": {
"trailingCommas": "none"
}
},
"overrides": [
{
"include": ["tests/*"],
"linter": {
"rules": {
"suspicious": {
"noExplicitAny": "off"
}
}
}
}
]
}
}
Loading

0 comments on commit bc39ca4

Please sign in to comment.