Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2037

Merged
merged 86 commits into from
Aug 26, 2024
Merged

Fix #2037

Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
4984788
reset to yodarm
drazisil Aug 20, 2024
2d4c34f
chore: Remove unused server.ts file and update tsconfig.json
drazisil Aug 21, 2024
6edb2d0
chore: Update node.yml workflow to improve testing process
drazisil Aug 21, 2024
6d685fb
Merge branch 'dev' into fix
drazisil Aug 21, 2024
2919192
chore: Update node.yml workflow to improve testing process
drazisil Aug 21, 2024
02e84c0
chore: wip - npm start still works
drazisil Aug 21, 2024
f8c6982
chore: wip - npm start still works
drazisil Aug 21, 2024
abf00b1
chore: wip - pnpm start works
drazisil Aug 21, 2024
b968a22
chore: Update node.yml workflow to use pnpm instead of npm for instal…
drazisil Aug 21, 2024
ea4bc07
chore(ci): switch to pnpm
drazisil Aug 21, 2024
7eafd53
chore: Update package.json to use pnpm@9.7.1
drazisil Aug 21, 2024
c4c59a6
chore: Add .deepsource.toml configuration file
drazisil Aug 21, 2024
4341bd5
chore: Update test:all script to use pnpm for running tests
drazisil Aug 21, 2024
52d0b8b
test: Add unit tests for ErrorNoKey class
drazisil Aug 21, 2024
c72b656
chore: Update tsconfig.json to extend base configuration
drazisil Aug 21, 2024
4858b6d
chore: Update npm dependency to use npx for running prettier
drazisil Aug 21, 2024
5e38ddf
chore: Update package.json to use pnpm for running check, lint, and f…
drazisil Aug 21, 2024
01fae3c
chore: Update web.ts to use consistent indentation and formatting
drazisil Aug 21, 2024
7aaff91
chore: Update log.debug message in getUser function to hide password
drazisil Aug 21, 2024
322cb24
chore: Refactor populateGameUsers function to remove unnecessary rename
drazisil Aug 21, 2024
4c8367d
refactor: Update EncryptionSession.ts to use DES for compatibility wi…
drazisil Aug 21, 2024
43814e0
chore: Remove unnecessary return statement in processUserLogin.ts
drazisil Aug 21, 2024
228acc4
chore: Rename StackCarInfo to StockCarInfo for consistency
drazisil Aug 21, 2024
d92997d
feat: Add BaseSerializable class for message serialization
drazisil Aug 21, 2024
ceb0214
refactor: Update MiniUserList serialization logic
drazisil Aug 21, 2024
00c00eb
refactor: Update MiniRiffList serialization logic and remove NPSList …
drazisil Aug 21, 2024
8c15b2b
refactor: Update SessionKey to extend BaseSerializable class
drazisil Aug 21, 2024
7fb1178
refactor: Update UserInfo serialization logic and extend BaseSerializ…
drazisil Aug 21, 2024
3b7ee26
refactor: Update ServerMessageHeader to extend BasePacket class
drazisil Aug 21, 2024
7c4d266
refactor: Update UserAction serialization logic and extend ISerializa…
drazisil Aug 21, 2024
e3aa58e
refactor: Update UserStatus serialization logic and extend BaseSerial…
drazisil Aug 21, 2024
ff85357
refactor: Update UserStatus serialization logic and extend BaseSerial…
drazisil Aug 21, 2024
d76d796
refactor: Update UserStatus serialization logic and extend BaseSerial…
drazisil Aug 22, 2024
4a93d91
refactor: Update ServerMessage.ts to use the updated getServerLogger …
drazisil Aug 22, 2024
d32edfb
refactor: Update ClientConnectMessage and utils to improve deserializ…
drazisil Aug 22, 2024
76b3c05
fix: add back database package
drazisil Aug 22, 2024
98fd4ba
refactor: Update account service to use rusty-motors-database package
drazisil Aug 22, 2024
b8f6b32
refactor: Update Makefile to export environment variables from .env file
drazisil Aug 22, 2024
a090432
refactor: Update Makefile to export environment variables from .env file
drazisil Aug 22, 2024
50d268a
refactor: Update Makefile to start postgres server for tests
drazisil Aug 22, 2024
2e14e8a
refactor: Update Makefile to start postgres server for tests
drazisil Aug 22, 2024
6a8ea9e
refactor: switch to using actual database
drazisil Aug 22, 2024
c31271e
refactor: Convert logLevel to lowercase in Configuration class
drazisil Aug 22, 2024
2fb70ba
refactor: Update devDependencies in package.json files
drazisil Aug 22, 2024
2d133da
refactor: Add utility functions for number comparison
drazisil Aug 22, 2024
6ed801d
refactor: Add utility functions for number comparison
drazisil Aug 22, 2024
d2a7b77
refactor: Update test file import path in pureCompare.test.ts
drazisil Aug 22, 2024
7cad266
refactor: Add utility functions for number comparison
drazisil Aug 22, 2024
c009d2c
refactor: Exclude generated files from code coverage reports
drazisil Aug 22, 2024
655e99e
refactor: Add McosEncryptionPair to shared exports
drazisil Aug 22, 2024
21cec84
refactor: Update tsconfig files for new packages
drazisil Aug 22, 2024
7729d68
refactor: Update import paths for shared log module
drazisil Aug 22, 2024
cec63ff
refactor: Update import paths for shared log module
drazisil Aug 22, 2024
557c143
refactor: Add SerializedBuffer to shared exports
drazisil Aug 22, 2024
ade5ddb
refactor: Add ServerError to shared exports
drazisil Aug 25, 2024
4b630ec
refactor: Disable useLiteralKeys lint rule in biome.json
drazisil Aug 25, 2024
af31360
refactor: Add "biomejs.biome" to recommended extensions
drazisil Aug 25, 2024
44fd10d
chore: formatting
drazisil Aug 25, 2024
aac22b4
chore: use dotenvx to load .env file for db types generation
drazisil Aug 25, 2024
5c1e55b
refactor: Update database module imports and configuration
drazisil Aug 25, 2024
a8bdd70
refactor: Update SerializedBuffer class in shared module
drazisil Aug 25, 2024
8fb934c
refactor: Remove unused import and log statement in getWarehouseInven…
drazisil Aug 25, 2024
b38d8b6
refactor: Update import paths for shared modules
drazisil Aug 25, 2024
b2a3b83
refactor: Update import paths for shared modules
drazisil Aug 25, 2024
561ac93
refactor: Update import paths for shared modules
drazisil Aug 25, 2024
2711c85
refactor: Update import paths for shared modules
drazisil Aug 25, 2024
9e715d2
refactor: Update import paths for shared modules - works
drazisil Aug 25, 2024
73ac98e
refactor: Update import paths for shared modules - works
drazisil Aug 25, 2024
78c2474
refactor: Update import paths for shared modules
drazisil Aug 25, 2024
596851c
refactor: Update import paths for shared modules
drazisil Aug 25, 2024
36e6769
refactor: Update import paths for shared modules - start works, lobby…
drazisil Aug 25, 2024
d5b98df
Merge branch 'fix' of github.com:rustymotors/server into fix
drazisil Aug 25, 2024
ad69707
refactor: Update import paths for shared modules - start works, lobby…
drazisil Aug 25, 2024
e91212a
refactor: Update import paths for shared modules - start works, lobby…
drazisil Aug 25, 2024
d0afb67
refactor: Add unit tests for tunables module
drazisil Aug 25, 2024
d8f14d6
refactor: Update import paths for shared modules in lobby and login p…
drazisil Aug 25, 2024
4b4625e
refactor: Remove unused code in shared-packets module - start works, …
drazisil Aug 25, 2024
7525cea
refactor: Update socket data handler to include local port in log mes…
drazisil Aug 25, 2024
7824fbc
refactor: Update validatePersonaName function to include response codes
drazisil Aug 25, 2024
1169961
refactor: update calls to log from nps, shart cutover to nps module f…
drazisil Aug 25, 2024
524bb62
refactor: Update import paths for shared modules in gateway, lobby, a…
drazisil Aug 25, 2024
159b0ea
refactor: Update user status handling in game login
drazisil Aug 25, 2024
f0192c3
refactor: Update import paths for shared modules in connection, gatew…
drazisil Aug 25, 2024
3aec526
refactor: Update import paths for shared modules in connection, gatew…
drazisil Aug 25, 2024
e2ecbf1
refactor: create sessions module
drazisil Aug 25, 2024
bf8bd2b
refactor: Add test directory to tsconfig.json
drazisil Aug 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version = 1

[[analyzers]]
name = "javascript"

[analyzers.meta]
environment = [
"nodejs",
"vitest"
]
28 changes: 14 additions & 14 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"env": {
"node": true,
"es2021": true
},
"plugins": ["prettier"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"prettier/prettier": "error",
"no-undef": "error"
}
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"env": {
"node": true,
"es2021": true
},
"plugins": ["prettier"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"prettier/prettier": "error",
"no-undef": "error"
}
}
52 changes: 30 additions & 22 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node.js CI
name: Node.js

on:
push:
Expand All @@ -7,45 +7,53 @@ on:

env:
MCO_LOG_LEVEL: warn
EXTERNAL_HOST: mcouniverse.com
PRIVATE_KEY_FILE: thebeast/data/private_key.pem # These secrets are stored in the repository and are safe to "leak"
CERTIFICATE_FILE: thebeast/data/mcouniverse.crt # These secrets are stored in the repository and are safe to "leak"
PUBLIC_KEY_FILE: thebeast/data/pub.key # These secrets are stored in the repository and are safe to "leak"

jobs:
build:
build-test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x, 21.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- name: Use Node.js 22.x
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci install
- name: Test
run: npm run test:only
node-version: 22.x
- name: Setup pnpm
uses: pnpm/action-setup@v4.0.0
- name: Install and test
run: |
pnpm install
make test
env:
CODECOV_UPLOAD_BUNDLE_TOKEN: ${{ secrets.CODECOV_UPLOAD_BUNDLE_TOKEN }}
- name: Codecov
env: # Or as an environment variable
if: ${{ always() }} # using always() to always run this step because i am uploading test results and coverage in one step
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
pip install --user pytest
pip install --user codecov-cli
codecovcli --verbose create-commit --fail-on-error
codecovcli --verbose create-report --fail-on-error
codecovcli --verbose create-commit --fail-on-error
codecovcli --verbose create-report --fail-on-error
codecovcli do-upload --report-type test_results --file mcos.junit.xml
codecovcli --verbose do-upload --fail-on-error --flag cli --name cli-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag connection --name connection-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag database --name database-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag gateway --name gateway-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag lobby --name lobby-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag login --name login-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag mcots --name mcots-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag nps --name nps-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag patch --name patch-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag persona --name persona-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag shard --name shard-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag transactions --name transactions-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag core --name core-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag shared --name shared-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag shared-packets --name shared-packets-${{ matrix.node-version }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
with:
name: coverage_${{ matrix.node-version }}
path: coverage
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ dist
# Sentry Auth Token
.sentryclirc
*.map
out/*
out/*
*.junit.xml
mcos.junit.xml
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node-options="--openssl-legacy-provider"
link-workspace-packages=true
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.5.1
22.6.0
12 changes: 6 additions & 6 deletions .renovaterc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": ["config:base"],
"statusCheckVerify": true,
"automerge": true,
"automergeType": "branch",
"rangeStrategy": "bump",
"enabledManagers": ["npm"]
"extends": ["config:base"],
"statusCheckVerify": true,
"automerge": true,
"automergeType": "branch",
"rangeStrategy": "bump",
"enabledManagers": ["npm"]
}
16 changes: 8 additions & 8 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"recommendations": [
"ms-azuretools.vscode-docker",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"ms-vscode.makefile-tools",
"usernamehw.errorlens"
]
}
"recommendations": [
"ms-azuretools.vscode-docker",
"esbenp.prettier-vscode",
"ms-vscode.makefile-tools",
"usernamehw.errorlens",
"biomejs.biome"
]
}
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"git.enableCommitSigning": true,
"typescript.tsdk": "node_modules/typescript/lib",
"js/ts.implicitProjectConfig.checkJs": true
"git.enableCommitSigning": true,
"typescript.tsdk": "node_modules/typescript/lib",
"js/ts.implicitProjectConfig.checkJs": true
}
30 changes: 25 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# This will read from .env file and export all the variables
# to the environment. This is useful for running the tests
# and other commands that require the environment variables
# to be set.
#
# Warning: This will cause the makefile to fail if the .env
# file is not present. This is the desired behavior as we
# want to make sure that the environment variables are set
# before running the tests.
# include .env // Disabled for now

all:
@npm install

Expand All @@ -8,14 +19,23 @@ certs:
@echo "certs regenerated. remember to update pub.key for all clients"

test:
@clear
@npm test
# This will start a postgres server in the background and run the tests
# against it. The server will be stopped after the tests are done.
#
# Note the use of `$$` to escape the `$` character. This is required
# because the command is being run in a subshell. That the command
# is being run in a subshell is why we can't use `export` to set the
# DATABASE_URL environment variable.
@DATABASE_URL=$$(npx pg-test start) && \
echo "Testing with DATABASE_URL=$$DATABASE_URL" && \
DATABASE_URL=$$DATABASE_URL pnpm migrate && \
DATABASE_URL=$$DATABASE_URL pnpm test
@npx pg-test stop


build:
@npm run build:dev

start:
@EXTERNAL_HOST=mcouniverse.com PRIVATE_KEY_FILE=data/private_key.pem CERTIFICATE_FILE=data/mcouniverse.crt PUBLIC_KEY_FILE=data/pub.key LOG_LEVEL=trace npm run start:dev
@pnpx tsx --openssl-legacy-provider --env-file=.env server.ts

prod_node:
docker-compose --file docker-compose.yml up -d --build
Expand Down
70 changes: 70 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"complexity": {
"noExtraBooleanCast": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noUselessCatch": "error",
"noWith": "error",
"useArrowFunction": "off",
"useLiteralKeys":"off"
},
"correctness": {
"noConstAssign": "error",
"noConstantCondition": "error",
"noEmptyCharacterClassInRegex": "error",
"noEmptyPattern": "error",
"noGlobalObjectCalls": "error",
"noInnerDeclarations": "error",
"noInvalidConstructorSuper": "error",
"noNewSymbol": "error",
"noNonoctalDecimalEscape": "error",
"noPrecisionLoss": "error",
"noSelfAssign": "error",
"noSetterReturn": "error",
"noSwitchDeclarations": "error",
"noUndeclaredVariables": "error",
"noUnreachable": "error",
"noUnreachableSuper": "error",
"noUnsafeFinally": "error",
"noUnsafeOptionalChaining": "error",
"noUnusedLabels": "error",
"noUnusedVariables": "error",
"useIsNan": "error",
"useValidForDirection": "error",
"useYield": "error"
},
"style": { "useBlockStatements": "off" },
"suspicious": {
"noAssignInExpressions": "error",
"noAsyncPromiseExecutor": "error",
"noCatchAssign": "error",
"noClassAssign": "error",
"noCompareNegZero": "error",
"noControlCharactersInRegex": "error",
"noDebugger": "error",
"noDuplicateCase": "error",
"noDuplicateClassMembers": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noEmptyBlockStatements": "error",
"noFallthroughSwitchClause": "error",
"noFunctionAssign": "error",
"noGlobalAssign": "error",
"noImportAssign": "error",
"noMisleadingCharacterClass": "error",
"noPrototypeBuiltins": "error",
"noRedeclare": "error",
"noShadowRestrictedNames": "error",
"noUnsafeNegation": "error",
"useGetterReturn": "error",
"useValidTypeof": "error"
}
},
"ignore": ["**/*.d.ts", "**/dist", "**/out"]
}
}
13 changes: 0 additions & 13 deletions jsconfig-old.json

This file was deleted.

Loading
Loading