-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'tabarra:develop' into develop
- Loading branch information
Showing
451 changed files
with
27,191 additions
and
19,984 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Run Tests for Workspaces | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- "**" | ||
|
||
jobs: | ||
run-tests: | ||
name: "Run Unit Testing" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Use Node.js 22 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
|
||
- name: Download all modules | ||
run: npm ci | ||
|
||
- name: Run Tests | ||
env: | ||
CI: true | ||
run: npm run test --workspaces |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019-2024 André Tabarra <[email protected]> | ||
Copyright (c) 2019-2025 André Tabarra <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { txDevEnv } from "@core/globalData"; | ||
import consoleFactory from "@lib/console"; | ||
import fatalError from "@lib/fatalError"; | ||
const console = consoleFactory('GlobalPlaceholder'); | ||
|
||
//Messages | ||
const MSG_VIOLATION = 'Global Proxy Access Violation!'; | ||
const MSG_BOOT_FAIL = 'Failed to boot due to Module Race Condition.'; | ||
const MSG_CONTACT_DEV = 'This error should never happen, please report it to the developers.'; | ||
const MSG_ERR_PARTIAL = 'Attempted to access txCore before it was initialized!'; | ||
|
||
|
||
/** | ||
* Returns a Proxy that will throw a fatalError when accessing an uninitialized property | ||
*/ | ||
export const getCoreProxy = (refSrc: any) => { | ||
return new Proxy(refSrc, { | ||
get: function (target, prop) { | ||
// if (!txDevEnv.ENABLED && Reflect.has(target, prop)) { | ||
// if (console.isVerbose) { | ||
// console.majorMultilineError([ | ||
// MSG_VIOLATION, | ||
// MSG_CONTACT_DEV, | ||
// `Getter for ${String(prop)}`, | ||
// ]); | ||
// } | ||
// return Reflect.get(target, prop).deref(); | ||
// } | ||
fatalError.Boot( | ||
22, | ||
[ | ||
MSG_BOOT_FAIL, | ||
MSG_CONTACT_DEV, | ||
['Getter for', String(prop)], | ||
], | ||
new Error(MSG_ERR_PARTIAL) | ||
); | ||
}, | ||
set: function (target, prop, value) { | ||
fatalError.Boot( | ||
23, | ||
[ | ||
MSG_BOOT_FAIL, | ||
MSG_CONTACT_DEV, | ||
['Setter for', String(prop)], | ||
], | ||
new Error(MSG_ERR_PARTIAL) | ||
); | ||
return true; | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
const modulename = 'Setup'; | ||
import path from 'node:path'; | ||
import fs from 'node:fs'; | ||
|
||
import chalk from 'chalk'; | ||
import consoleFactory from '@lib/console'; | ||
import fatalError from '@lib/fatalError'; | ||
import { txEnv } from '@core/globalData'; | ||
import ConfigStore from '@modules/ConfigStore'; | ||
const console = consoleFactory(modulename); | ||
|
||
|
||
/** | ||
* Ensure the profile subfolders exist | ||
*/ | ||
export const ensureProfileStructure = () => { | ||
const dataPath = path.join(txEnv.profilePath, 'data'); | ||
if (!fs.existsSync(dataPath)) { | ||
fs.mkdirSync(dataPath); | ||
} | ||
|
||
const logsPath = path.join(txEnv.profilePath, 'logs'); | ||
if (!fs.existsSync(logsPath)) { | ||
fs.mkdirSync(logsPath); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* Setup the profile folder structure | ||
*/ | ||
export const setupProfile = () => { | ||
console.log(console.DIVIDER); | ||
//Create new profile folder | ||
console.log('Creating new profile folder...'); | ||
try { | ||
fs.mkdirSync(txEnv.profilePath); | ||
const configStructure = ConfigStore.getEmptyConfigFile(); | ||
fs.writeFileSync( | ||
path.join(txEnv.profilePath, 'config.json'), | ||
JSON.stringify(configStructure, null, 2) | ||
); | ||
ensureProfileStructure(); | ||
} catch (error) { | ||
fatalError.Boot(4, [ | ||
'Failed to set up folder structure for the new profile.', | ||
['Path', txEnv.profilePath], | ||
], error); | ||
} | ||
console.ok(`Server profile was saved in '${txEnv.profilePath}'`); | ||
|
||
//Saving start.bat (yes, I also wish this didn't exist) | ||
if (txEnv.osType == 'windows') { | ||
const batFilename = `start_${txEnv.fxsVersion}_${txEnv.profile}.bat`; | ||
try { | ||
const fxsPath = path.join(txEnv.fxServerPath, 'FXServer.exe'); | ||
const batLines = [ | ||
//TODO: add note to not add any server convars in here | ||
`@echo off`, | ||
`"${fxsPath}" +set serverProfile "${txEnv.profile}"`, | ||
`pause` | ||
]; | ||
const batFolder = path.resolve(txEnv.fxServerPath, '..'); | ||
const batPath = path.join(batFolder, batFilename); | ||
fs.writeFileSync(batPath, batLines.join('\r\n')); | ||
console.ok(`You can use ${chalk.inverse(batPath)} to start this profile.`); | ||
} catch (error) { | ||
console.warn(`Failed to create '${batFilename}' with error:`); | ||
console.dir(error); | ||
} | ||
} | ||
console.log(console.DIVIDER); | ||
}; |
Oops, something went wrong.