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

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>
This commit is contained in:
Refringe 2024-12-29 16:01:50 -05:00 committed by GitHub
parent a29533aa9f
commit 9aadae00e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 45 additions and 55 deletions

View File

@ -27,21 +27,20 @@
{ {
"name": "Debug", "name": "Debug",
"type": "node", "type": "node",
"program": "${workspaceFolder}/src/ide/TestEntry.ts",
"runtimeVersion": "20.11.1", "runtimeVersion": "20.11.1",
"runtimeExecutable": "npm", "runtimeExecutable": "tsx",
"request": "launch", "request": "launch",
"sourceMaps": true,
"runtimeArgs": [ "runtimeArgs": [
"run", "watch",
"run:debug" "--clear-screen=false"
], ],
"outFiles": [
"!**/node_modules/**"
],
"cwd": "${workspaceFolder}",
"outputCapture": "std",
"console": "integratedTerminal", "console": "integratedTerminal",
"internalConsoleOptions": "neverOpen" "internalConsoleOptions": "neverOpen",
"skipFiles": [
"<node_internals>/**",
"${workspaceFolder}/node_modules/**",
],
}, },
{ {
"name": "Run Vitest Tests", "name": "Run Vitest Tests",
@ -55,12 +54,10 @@
], ],
"console": "integratedTerminal", "console": "integratedTerminal",
"internalConsoleOptions": "neverOpen", "internalConsoleOptions": "neverOpen",
"cwd": "${workspaceFolder}", "skipFiles": [
"sourceMaps": true, "<node_internals>/**",
"outputCapture": "std", "${workspaceFolder}/node_modules/**",
"outFiles": [ ],
"!**/node_modules/**"
]
} }
] ]
} }

View File

@ -325,10 +325,6 @@ gulp.task("build:bleeding", build("bleeding"));
gulp.task("build:bleedingmods", build("bleedingmods")); gulp.task("build:bleedingmods", build("bleedingmods"));
gulp.task("run:build", async () => await exec(serverExeName, { stdio, cwd: buildDir })); gulp.task("run:build", async () => await exec(serverExeName, { stdio, cwd: buildDir }));
gulp.task(
"run:debug",
async () => await exec("ts-node-dev -r tsconfig-paths/register src/ide/TestEntry.ts", { stdio }),
);
gulp.task("run:profiler", async () => { gulp.task("run:profiler", async () => {
await cleanCompiled(); await cleanCompiled();
await compile(); await compile();

View File

@ -26,12 +26,12 @@
"build:bleeding": "cross-env PKG_CACHE_PATH=\"./.pkg-cache\" gulp build:bleeding", "build:bleeding": "cross-env PKG_CACHE_PATH=\"./.pkg-cache\" gulp build:bleeding",
"build:bleedingmods": "cross-env PKG_CACHE_PATH=\"./.pkg-cache\" gulp build:bleedingmods", "build:bleedingmods": "cross-env PKG_CACHE_PATH=\"./.pkg-cache\" gulp build:bleedingmods",
"run:build": "gulp run:build", "run:build": "gulp run:build",
"run:debug": "gulp run:debug", "run:debug": "tsx ./src/ide/TestEntry.ts",
"run:profiler": "gulp run:profiler", "run:profiler": "gulp run:profiler",
"gen:types": "tsc -p tsconfig.typedef.json --resolveJsonModule", "gen:types": "tsc -p tsconfig.types.json",
"gen:docs": "typedoc --options ./typedoc.json --entryPointStrategy expand ./src", "gen:docs": "typedoc --options ./typedoc.json --entryPointStrategy expand ./src",
"gen:items": "ts-node -r tsconfig-paths/register ./src/tools/ItemTplGenerator/ItemTplGeneratorProgram.ts", "gen:items": "tsx ./src/tools/ItemTplGenerator/ItemTplGeneratorProgram.ts",
"gen:productionquests": "ts-node -r tsconfig-paths/register ./src/tools/ProductionQuestsGen/ProductionQuestsGenProgram.ts" "gen:productionquests": "tsx ./src/tools/ProductionQuestsGen/ProductionQuestsGenProgram.ts"
}, },
"dependencies": { "dependencies": {
"atomically": "~1.7", "atomically": "~1.7",
@ -51,7 +51,6 @@
"source-map-support": "~0.5", "source-map-support": "~0.5",
"string-similarity-js": "~2.1", "string-similarity-js": "~2.1",
"tsyringe": "~4.8", "tsyringe": "~4.8",
"typescript": "~5.5",
"winston": "~3.13", "winston": "~3.13",
"winston-daily-rotate-file": "~5.0", "winston-daily-rotate-file": "~5.0",
"ws": "~8.18" "ws": "~8.18"
@ -79,9 +78,9 @@
"madge": "~7", "madge": "~7",
"minimist": "~1.2", "minimist": "~1.2",
"resedit": "~2.0", "resedit": "~2.0",
"ts-node-dev": "~2.0", "tsx": "4.19.2",
"tsconfig-paths": "~4.2",
"typedoc": "~0.26", "typedoc": "~0.26",
"typescript": "~5.5",
"vitest": "^2.1.8" "vitest": "^2.1.8"
}, },
"targets": { "targets": {

View File

@ -1,21 +0,0 @@
{
"compilerOptions": {
"noUncheckedIndexedAccess": true,
"moduleDetection": "force",
"allowJs": false,
"module": "CommonJS",
"target": "ES2022",
"allowSyntheticDefaultImports": true,
"moduleResolution": "Node10",
"esModuleInterop": true,
"downlevelIteration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"baseUrl": ".",
"paths": {
"@spt/*": ["src/*"],
"@tests/*": ["tests/*"]
}
},
"include": ["src/*", "src/**/*"]
}

View File

@ -1,10 +1,27 @@
{ {
"extends": "./tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"strict": false,
"moduleDetection": "force",
"module": "Preserve",
"resolveJsonModule": true, "resolveJsonModule": true,
"outDir": "obj", "allowJs": true,
"declaration": true "esModuleInterop": true,
"isolatedModules": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"verbatimModuleSyntax": false,
"baseUrl": ".",
"paths": {
"@spt/*": [
"./src/*"
],
"@tests/*": [
"./tests/*"
]
},
}, },
"include": ["./src/**/*", "./tests/**/*", "./types/**/*", "./user/mods/**/*"], "include": [
"exclude": ["./user/mods/**/*"] "src/*",
"src/**/*"
]
} }

View File

@ -1,9 +1,11 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"emitDeclarationOnly": true, "emitDeclarationOnly": true,
"declaration": true, "declaration": true,
"declarationDir": "./types" "declarationDir": "./types"
}, },
"exclude": ["./types/**/*"] "exclude": [
"./types/**/*"
]
} }