mirror of
https://github.com/LostCityRS/Server
synced 2026-11-22 23:10:40 -05:00
feat: Platform-agnostic start scripts
This commit is contained in:
1 parent
b908787823
commit
590c168606
8 files changed
+371
-267
No files matched your search
@@ -0,0 +1,4 @@
|
||||
node_modules/
|
||||
.DS_Store
|
||||
|
||||
server.json
|
||||
@@ -34,31 +34,6 @@ You can press `ctrl + c` to cancel/quit out of a terminal process.
|
||||
|
||||
**Use the start script provided** - it handles a lot of common use cases. We're trying to reduce the barrier to entry by providing an all-inclusive script.
|
||||
|
||||
### Start Server
|
||||
|
||||
This should be used by most people. It checks for dependency updates and starts the server normally.
|
||||
|
||||
### Start Server (engine dev)
|
||||
|
||||
This should be used if you're making changes to .ts files and want the server to restart automatically.
|
||||
|
||||
### Update Source
|
||||
|
||||
This pulls in the latest changes for our repos.
|
||||
|
||||
### (Re)configure Server
|
||||
|
||||
This runs the configuration setup script for you again.
|
||||
|
||||
### Clean-build Server
|
||||
|
||||
This performs a clean and rebuild of the server and client cache. Use this as a common troubleshooting step.
|
||||
|
||||
### Build Web Client
|
||||
|
||||
**Only needed if you are editing the web client!**
|
||||
This bundles a new webclient and copies it into the server to use. Refresh the client page after building.
|
||||
|
||||
## Common Issues
|
||||
|
||||
* `bad option: --import`
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"lockfileVersion": 1,
|
||||
"workspaces": {
|
||||
"": {
|
||||
"name": "server",
|
||||
"dependencies": {
|
||||
"@inquirer/prompts": "^7.5.3",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bun": "latest",
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "^5",
|
||||
},
|
||||
},
|
||||
},
|
||||
"packages": {
|
||||
"@inquirer/checkbox": ["@inquirer/checkbox@4.1.8", "", { "dependencies": { "@inquirer/core": "^10.1.13", "@inquirer/figures": "^1.0.12", "@inquirer/type": "^3.0.7", "ansi-escapes": "^4.3.2", "yoctocolors-cjs": "^2.1.2" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-d/QAsnwuHX2OPolxvYcgSj7A9DO9H6gVOy2DvBTx+P2LH2iRTo/RSGV3iwCzW024nP9hw98KIuDmdyhZQj1UQg=="],
|
||||
|
||||
"@inquirer/confirm": ["@inquirer/confirm@5.1.12", "", { "dependencies": { "@inquirer/core": "^10.1.13", "@inquirer/type": "^3.0.7" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-dpq+ielV9/bqgXRUbNH//KsY6WEw9DrGPmipkpmgC1Y46cwuBTNx7PXFWTjc3MQ+urcc0QxoVHcMI0FW4Ok0hg=="],
|
||||
|
||||
"@inquirer/core": ["@inquirer/core@10.1.13", "", { "dependencies": { "@inquirer/figures": "^1.0.12", "@inquirer/type": "^3.0.7", "ansi-escapes": "^4.3.2", "cli-width": "^4.1.0", "mute-stream": "^2.0.0", "signal-exit": "^4.1.0", "wrap-ansi": "^6.2.0", "yoctocolors-cjs": "^2.1.2" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-1viSxebkYN2nJULlzCxES6G9/stgHSepZ9LqqfdIGPHj5OHhiBUXVS0a6R0bEC2A+VL4D9w6QB66ebCr6HGllA=="],
|
||||
|
||||
"@inquirer/editor": ["@inquirer/editor@4.2.13", "", { "dependencies": { "@inquirer/core": "^10.1.13", "@inquirer/type": "^3.0.7", "external-editor": "^3.1.0" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-WbicD9SUQt/K8O5Vyk9iC2ojq5RHoCLK6itpp2fHsWe44VxxcA9z3GTWlvjSTGmMQpZr+lbVmrxdHcumJoLbMA=="],
|
||||
|
||||
"@inquirer/expand": ["@inquirer/expand@4.0.15", "", { "dependencies": { "@inquirer/core": "^10.1.13", "@inquirer/type": "^3.0.7", "yoctocolors-cjs": "^2.1.2" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-4Y+pbr/U9Qcvf+N/goHzPEXiHH8680lM3Dr3Y9h9FFw4gHS+zVpbj8LfbKWIb/jayIB4aSO4pWiBTrBYWkvi5A=="],
|
||||
|
||||
"@inquirer/figures": ["@inquirer/figures@1.0.12", "", {}, "sha512-MJttijd8rMFcKJC8NYmprWr6hD3r9Gd9qUC0XwPNwoEPWSMVJwA2MlXxF+nhZZNMY+HXsWa+o7KY2emWYIn0jQ=="],
|
||||
|
||||
"@inquirer/input": ["@inquirer/input@4.1.12", "", { "dependencies": { "@inquirer/core": "^10.1.13", "@inquirer/type": "^3.0.7" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-xJ6PFZpDjC+tC1P8ImGprgcsrzQRsUh9aH3IZixm1lAZFK49UGHxM3ltFfuInN2kPYNfyoPRh+tU4ftsjPLKqQ=="],
|
||||
|
||||
"@inquirer/number": ["@inquirer/number@3.0.15", "", { "dependencies": { "@inquirer/core": "^10.1.13", "@inquirer/type": "^3.0.7" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-xWg+iYfqdhRiM55MvqiTCleHzszpoigUpN5+t1OMcRkJrUrw7va3AzXaxvS+Ak7Gny0j2mFSTv2JJj8sMtbV2g=="],
|
||||
|
||||
"@inquirer/password": ["@inquirer/password@4.0.15", "", { "dependencies": { "@inquirer/core": "^10.1.13", "@inquirer/type": "^3.0.7", "ansi-escapes": "^4.3.2" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-75CT2p43DGEnfGTaqFpbDC2p2EEMrq0S+IRrf9iJvYreMy5mAWj087+mdKyLHapUEPLjN10mNvABpGbk8Wdraw=="],
|
||||
|
||||
"@inquirer/prompts": ["@inquirer/prompts@7.5.3", "", { "dependencies": { "@inquirer/checkbox": "^4.1.8", "@inquirer/confirm": "^5.1.12", "@inquirer/editor": "^4.2.13", "@inquirer/expand": "^4.0.15", "@inquirer/input": "^4.1.12", "@inquirer/number": "^3.0.15", "@inquirer/password": "^4.0.15", "@inquirer/rawlist": "^4.1.3", "@inquirer/search": "^3.0.15", "@inquirer/select": "^4.2.3" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-8YL0WiV7J86hVAxrh3fE5mDCzcTDe1670unmJRz6ArDgN+DBK1a0+rbnNWp4DUB5rPMwqD5ZP6YHl9KK1mbZRg=="],
|
||||
|
||||
"@inquirer/rawlist": ["@inquirer/rawlist@4.1.3", "", { "dependencies": { "@inquirer/core": "^10.1.13", "@inquirer/type": "^3.0.7", "yoctocolors-cjs": "^2.1.2" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-7XrV//6kwYumNDSsvJIPeAqa8+p7GJh7H5kRuxirct2cgOcSWwwNGoXDRgpNFbY/MG2vQ4ccIWCi8+IXXyFMZA=="],
|
||||
|
||||
"@inquirer/search": ["@inquirer/search@3.0.15", "", { "dependencies": { "@inquirer/core": "^10.1.13", "@inquirer/figures": "^1.0.12", "@inquirer/type": "^3.0.7", "yoctocolors-cjs": "^2.1.2" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-YBMwPxYBrADqyvP4nNItpwkBnGGglAvCLVW8u4pRmmvOsHUtCAUIMbUrLX5B3tFL1/WsLGdQ2HNzkqswMs5Uaw=="],
|
||||
|
||||
"@inquirer/select": ["@inquirer/select@4.2.3", "", { "dependencies": { "@inquirer/core": "^10.1.13", "@inquirer/figures": "^1.0.12", "@inquirer/type": "^3.0.7", "ansi-escapes": "^4.3.2", "yoctocolors-cjs": "^2.1.2" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-OAGhXU0Cvh0PhLz9xTF/kx6g6x+sP+PcyTiLvCrewI99P3BBeexD+VbuwkNDvqGkk3y2h5ZiWLeRP7BFlhkUDg=="],
|
||||
|
||||
"@inquirer/type": ["@inquirer/type@3.0.7", "", { "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-PfunHQcjwnju84L+ycmcMKB/pTPIngjUJvfnRhKY6FKPuYXlM4aQCb/nIdTFR6BEhMjFvngzvng/vBAJMZpLSA=="],
|
||||
|
||||
"@types/bun": ["@types/bun@1.2.15", "", { "dependencies": { "bun-types": "1.2.15" } }, "sha512-U1ljPdBEphF0nw1MIk0hI7kPg7dFdPyM7EenHsp6W5loNHl7zqy6JQf/RKCgnUn2KDzUpkBwHPnEJEjII594bA=="],
|
||||
|
||||
"@types/node": ["@types/node@22.15.29", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-LNdjOkUDlU1RZb8e1kOIUpN1qQUlzGkEtbVNo53vbrwDg5om6oduhm4SiUaPW5ASTXhAiP0jInWG8Qx9fVlOeQ=="],
|
||||
|
||||
"ansi-escapes": ["ansi-escapes@4.3.2", "", { "dependencies": { "type-fest": "^0.21.3" } }, "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ=="],
|
||||
|
||||
"ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
||||
|
||||
"ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||
|
||||
"bun-types": ["bun-types@1.2.15", "", { "dependencies": { "@types/node": "*" } }, "sha512-NarRIaS+iOaQU1JPfyKhZm4AsUOrwUOqRNHY0XxI8GI8jYxiLXLcdjYMG9UKS+fwWasc1uw1htV9AX24dD+p4w=="],
|
||||
|
||||
"chardet": ["chardet@0.7.0", "", {}, "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA=="],
|
||||
|
||||
"cli-width": ["cli-width@4.1.0", "", {}, "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ=="],
|
||||
|
||||
"color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
|
||||
|
||||
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
|
||||
|
||||
"emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
|
||||
|
||||
"external-editor": ["external-editor@3.1.0", "", { "dependencies": { "chardet": "^0.7.0", "iconv-lite": "^0.4.24", "tmp": "^0.0.33" } }, "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew=="],
|
||||
|
||||
"iconv-lite": ["iconv-lite@0.4.24", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3" } }, "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA=="],
|
||||
|
||||
"is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="],
|
||||
|
||||
"mute-stream": ["mute-stream@2.0.0", "", {}, "sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA=="],
|
||||
|
||||
"os-tmpdir": ["os-tmpdir@1.0.2", "", {}, "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g=="],
|
||||
|
||||
"safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],
|
||||
|
||||
"signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="],
|
||||
|
||||
"string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
|
||||
|
||||
"strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
|
||||
|
||||
"tmp": ["tmp@0.0.33", "", { "dependencies": { "os-tmpdir": "~1.0.2" } }, "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw=="],
|
||||
|
||||
"type-fest": ["type-fest@0.21.3", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="],
|
||||
|
||||
"typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
|
||||
|
||||
"undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
|
||||
|
||||
"wrap-ansi": ["wrap-ansi@6.2.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="],
|
||||
|
||||
"yoctocolors-cjs": ["yoctocolors-cjs@2.1.2", "", {}, "sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA=="],
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "server",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@types/bun": "latest"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "^5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@inquirer/prompts": "^7.5.3"
|
||||
}
|
||||
}
|
||||
@@ -36,157 +36,4 @@ if %jver% lss 170 (
|
||||
exit /b
|
||||
)
|
||||
|
||||
:index
|
||||
if not exist engine (
|
||||
goto startProj
|
||||
)
|
||||
|
||||
echo 1. Start Server
|
||||
echo 2. Start Server (engine dev)
|
||||
echo 3. Update Source
|
||||
if exist engine\.env (
|
||||
echo 4. Reconfigure Server
|
||||
) else (
|
||||
echo 4. Configure Server
|
||||
)
|
||||
echo 5. Clean-build Server
|
||||
echo 6. Build Web Client
|
||||
echo 7. Run Java Client
|
||||
set /p "action=> " || cmd /c exit -1073741510
|
||||
|
||||
if %action% == 1 (
|
||||
goto startProj
|
||||
) else if %action% == 2 (
|
||||
goto startProjDev
|
||||
) else if %action% == 3 (
|
||||
goto updateProj
|
||||
) else if %action% == 4 (
|
||||
goto reconfigureProj
|
||||
) else if %action% == 5 (
|
||||
goto rebuildProj
|
||||
) else if %action% == 6 (
|
||||
goto buildWebClient
|
||||
) else if %action% == 7 (
|
||||
goto runJavaClient
|
||||
)
|
||||
|
||||
cls
|
||||
echo Invalid input
|
||||
goto index
|
||||
|
||||
:selectVer
|
||||
echo Please select a game version - use the number to confirm your option:
|
||||
echo 225. May 18, 2004
|
||||
set /p "rev=> " || cmd /c exit -1073741510
|
||||
|
||||
if %rev% == 225 (
|
||||
goto downloadVer
|
||||
)
|
||||
|
||||
cls
|
||||
echo Invalid input
|
||||
goto selectVer
|
||||
|
||||
:downloadVer
|
||||
git clone https://github.com/LostCityRS/Engine-TS engine -b %rev% --single-branch
|
||||
git clone https://github.com/LostCityRS/Content content -b %rev% --single-branch
|
||||
git clone https://github.com/LostCityRS/Client-TS webclient -b %rev% --single-branch
|
||||
git clone https://github.com/LostCityRS/Client-Java javaclient -b %rev% --single-branch
|
||||
goto index
|
||||
|
||||
:startProj
|
||||
if not exist engine (
|
||||
goto selectVer
|
||||
)
|
||||
|
||||
cd engine
|
||||
|
||||
if not exist .env (
|
||||
call bun install
|
||||
call bun run setup
|
||||
)
|
||||
|
||||
start bun start
|
||||
exit
|
||||
|
||||
:startProjDev
|
||||
if not exist engine (
|
||||
goto selectVer
|
||||
)
|
||||
|
||||
cd engine
|
||||
|
||||
if not exist .env (
|
||||
call bun install
|
||||
call bun run setup
|
||||
)
|
||||
|
||||
call bun run dev
|
||||
exit
|
||||
|
||||
:updateProj
|
||||
if not exist engine (
|
||||
goto selectVer
|
||||
)
|
||||
|
||||
cd engine
|
||||
git pull
|
||||
cd ..
|
||||
|
||||
if not exist content (
|
||||
goto selectVer
|
||||
)
|
||||
|
||||
cd content
|
||||
git pull
|
||||
cd ..
|
||||
|
||||
if not exist webclient (
|
||||
goto selectVer
|
||||
)
|
||||
|
||||
cd webclient
|
||||
git pull
|
||||
cd ..
|
||||
|
||||
if not exist javaclient (
|
||||
goto selectVer
|
||||
)
|
||||
|
||||
cd javaclient
|
||||
git pull
|
||||
cd ..
|
||||
|
||||
goto index
|
||||
|
||||
:reconfigureProj
|
||||
cd engine
|
||||
call bun install
|
||||
call bun run setup
|
||||
|
||||
cd ..
|
||||
goto index
|
||||
|
||||
:rebuildProj
|
||||
cd engine
|
||||
call bun run clean
|
||||
call bun run build
|
||||
|
||||
cd ..
|
||||
goto index
|
||||
|
||||
:buildWebClient
|
||||
cd webclient
|
||||
call bun run build
|
||||
copy out\client.js ..\engine\public\client\client.js
|
||||
copy out\deps.js ..\engine\public\client\deps.js
|
||||
|
||||
cd ..
|
||||
goto index
|
||||
|
||||
:runJavaClient
|
||||
cd javaclient
|
||||
call gradlew.bat run --args="10 0 highmem members"
|
||||
|
||||
cd ..
|
||||
goto index
|
||||
bun run start.ts
|
||||
@@ -31,91 +31,4 @@ if [ $jver -lt 17 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
index () {
|
||||
if [ ! -d engine ]; then
|
||||
startProj
|
||||
return
|
||||
fi
|
||||
|
||||
echo 1. Start
|
||||
echo 2. Update
|
||||
if [ -f engine/.env ]; then
|
||||
echo 3. Reconfigure
|
||||
else
|
||||
echo 3. Configure
|
||||
fi
|
||||
|
||||
read -p "" action
|
||||
if [ "$action" = "1" ]; then
|
||||
startProj
|
||||
elif [ "$action" = "2" ]; then
|
||||
updateProj
|
||||
elif [ "$action" = "3" ]; then
|
||||
reconfigureProj
|
||||
else
|
||||
clear
|
||||
echo Invalid input
|
||||
index
|
||||
fi
|
||||
}
|
||||
|
||||
selectVer () {
|
||||
echo Please select a game version - use the number to confirm your option:
|
||||
echo 225. May 18, 2004
|
||||
echo 244. June 28, 2004
|
||||
|
||||
read -p "" rev
|
||||
if [ "$rev" = "225" ]; then
|
||||
git clone https://github.com/LostCityRS/Engine-TS engine -b $rev --single-branch
|
||||
git clone https://github.com/LostCityRS/Content content -b $rev --single-branch
|
||||
git clone https://github.com/LostCityRS/Client-TS webclient -b $rev --single-branch
|
||||
index
|
||||
else
|
||||
clear
|
||||
echo Invalid input
|
||||
selectVer
|
||||
fi
|
||||
}
|
||||
|
||||
startProj () {
|
||||
if [ ! -d engine ]; then
|
||||
selectVer
|
||||
return
|
||||
fi
|
||||
|
||||
cd engine
|
||||
|
||||
if [ ! -f .env ]; then
|
||||
bun install
|
||||
bun run setup
|
||||
fi
|
||||
|
||||
bun start
|
||||
}
|
||||
|
||||
updateProj () {
|
||||
cd engine
|
||||
git pull
|
||||
cd ..
|
||||
|
||||
cd content
|
||||
git pull
|
||||
cd ..
|
||||
|
||||
cd webclient
|
||||
git pull
|
||||
cd ..
|
||||
|
||||
index
|
||||
}
|
||||
|
||||
reconfigureProj () {
|
||||
cd engine
|
||||
bun install
|
||||
bun run setup
|
||||
|
||||
cd ..
|
||||
index
|
||||
}
|
||||
|
||||
index
|
||||
bun run start.ts
|
||||
@@ -0,0 +1,226 @@
|
||||
import child_process from 'child_process';
|
||||
import fs from 'fs';
|
||||
|
||||
import { ExitPromptError } from '@inquirer/core';
|
||||
import { confirm, input, number, password, select } from '@inquirer/prompts';
|
||||
|
||||
// if you're forking this feel free to change these :) it does make some assumptions elsewhere (branch names)
|
||||
const repoOrg = 'https://github.com/LostCityRS';
|
||||
const engineRepo = 'Engine-TS';
|
||||
const contentRepo = 'Content';
|
||||
const webRepo = 'Client-TS';
|
||||
const javaRepo = 'Client-Java';
|
||||
|
||||
function cloneRepo(repo: string, dir: string, branch: string) {
|
||||
child_process.execSync(`git clone ${repoOrg}/${repo} --single-branch -b ${branch} ${dir}`, {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
}
|
||||
|
||||
function updateRepo(cwd: string) {
|
||||
child_process.execSync('git pull', {
|
||||
stdio: 'inherit',
|
||||
cwd
|
||||
});
|
||||
}
|
||||
|
||||
function runOnOs(exec: string, cwd?: string) {
|
||||
const start = (process.platform == 'darwin' ? 'open' : process.platform == 'win32' ? 'start' : 'xdg-open');
|
||||
|
||||
child_process.execSync(`${start} ${exec}`, {
|
||||
stdio: 'inherit',
|
||||
cwd
|
||||
});
|
||||
}
|
||||
|
||||
let config = {
|
||||
rev: 'unset'
|
||||
};
|
||||
|
||||
let running = true;
|
||||
async function main() {
|
||||
if (!fs.existsSync('server.json')) {
|
||||
await promptConfig();
|
||||
}
|
||||
|
||||
config = JSON.parse(fs.readFileSync('server.json', 'utf8'));
|
||||
|
||||
if (!fs.existsSync('engine')) {
|
||||
cloneRepo(engineRepo, 'engine', config.rev);
|
||||
}
|
||||
|
||||
if (!fs.existsSync('content')) {
|
||||
cloneRepo(contentRepo, 'content', config.rev);
|
||||
}
|
||||
|
||||
if (!fs.existsSync('webclient')) {
|
||||
cloneRepo(webRepo, 'webclient', config.rev);
|
||||
}
|
||||
|
||||
if (!fs.existsSync('javaclient')) {
|
||||
cloneRepo(javaRepo, 'javaclient', config.rev);
|
||||
}
|
||||
|
||||
if (!fs.existsSync('engine/.env')) {
|
||||
child_process.spawnSync('bun run setup', {
|
||||
shell: true,
|
||||
stdio: 'inherit',
|
||||
cwd: 'engine'
|
||||
});
|
||||
}
|
||||
|
||||
const choice = await select({
|
||||
message: 'What would you like to do?',
|
||||
choices: [{
|
||||
name: 'Start Server',
|
||||
description: 'Starts the server normally',
|
||||
value: 'start'
|
||||
}, {
|
||||
name: 'Update Source',
|
||||
description: 'Pull the latest commits for all subprojects',
|
||||
value: 'update'
|
||||
}, {
|
||||
name: 'Run Web Client',
|
||||
description: 'Opens your browser to play using the modern web client (TypeScript)',
|
||||
value: 'web'
|
||||
}, {
|
||||
name: 'Run Java Client',
|
||||
description: 'Opens the legacy Java applet to play using the original client',
|
||||
value: 'java'
|
||||
}, {
|
||||
name: 'Advanced Options',
|
||||
description: 'View more options',
|
||||
value: 'advanced'
|
||||
}, {
|
||||
name: 'Quit',
|
||||
description: '',
|
||||
value: 'quit'
|
||||
}]
|
||||
}, { clearPromptOnDone: true });
|
||||
|
||||
if (choice === 'start') {
|
||||
child_process.execSync('bun start', {
|
||||
stdio: 'inherit',
|
||||
cwd: 'engine'
|
||||
});
|
||||
} else if (choice === 'update') {
|
||||
updateRepo('engine');
|
||||
updateRepo('content');
|
||||
updateRepo('webclient');
|
||||
updateRepo('javaclient');
|
||||
} else if (choice === 'web') {
|
||||
if (process.platform === 'win32' || process.platform === 'darwin') {
|
||||
runOnOs('http://localhost/rs2.cgi');
|
||||
} else {
|
||||
runOnOs('http://localhost:8888/rs2.cgi');
|
||||
}
|
||||
} else if (choice === 'java') {
|
||||
child_process.execSync('gradlew run --args="10 0 highmem members"', {
|
||||
stdio: 'inherit',
|
||||
cwd: 'javaclient'
|
||||
});
|
||||
} else if (choice === 'advanced') {
|
||||
await promptAdvanced();
|
||||
} else if (choice === 'quit') {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function promptConfig() {
|
||||
const rev = await select({
|
||||
message: 'What version are you interested in?',
|
||||
choices: [{
|
||||
name: '225',
|
||||
description: 'May 18, 2004',
|
||||
value: '225'
|
||||
}]
|
||||
}, { clearPromptOnDone: true });
|
||||
|
||||
config.rev = rev;
|
||||
fs.writeFileSync('server.json', JSON.stringify(config, null, 2));
|
||||
}
|
||||
|
||||
async function promptAdvanced() {
|
||||
const choice = await select({
|
||||
message: 'What would you like to do?',
|
||||
choices: [{
|
||||
name: 'Start Server (engine dev)',
|
||||
description: 'Starts the server and watches for .ts file changes to reload',
|
||||
value: 'start-dev'
|
||||
}, {
|
||||
// todo:
|
||||
// name: 'Reconfigure Server',
|
||||
// description: 'Edit the environment config for the server',
|
||||
// value: 'configure'
|
||||
// }, {
|
||||
name: 'Clean-build Server',
|
||||
description: '',
|
||||
value: 'clean-build'
|
||||
}, {
|
||||
name: 'Build Web Client',
|
||||
description: '',
|
||||
value: 'build-web'
|
||||
}, {
|
||||
name: 'Build Java Client',
|
||||
description: '',
|
||||
value: 'build-java'
|
||||
}, {
|
||||
name: 'Back',
|
||||
description: 'Go back',
|
||||
value: 'back'
|
||||
}]
|
||||
}, { clearPromptOnDone: true });
|
||||
|
||||
if (choice === 'start-dev') {
|
||||
child_process.execSync('bun run dev', {
|
||||
stdio: 'inherit',
|
||||
cwd: 'engine'
|
||||
});
|
||||
} else if (choice === 'configure') {
|
||||
// todo: has issues with input appearing right now
|
||||
child_process.spawnSync('bun run setup', {
|
||||
shell: true,
|
||||
stdio: 'inherit',
|
||||
cwd: 'engine'
|
||||
});
|
||||
} else if (choice === 'clean-build') {
|
||||
child_process.execSync('bun run clean', {
|
||||
stdio: 'inherit',
|
||||
cwd: 'engine'
|
||||
});
|
||||
|
||||
child_process.execSync('bun run build', {
|
||||
stdio: 'inherit',
|
||||
cwd: 'engine'
|
||||
});
|
||||
} else if (choice === 'build-web') {
|
||||
child_process.execSync('bun run build', {
|
||||
stdio: 'inherit',
|
||||
cwd: 'webclient'
|
||||
});
|
||||
|
||||
fs.copyFileSync('webclient/out/client.js', 'engine/public/client/client.js');
|
||||
fs.copyFileSync('webclient/out/deps.js', 'engine/public/client/deps.js');
|
||||
} else if (choice === 'build-java') {
|
||||
child_process.execSync('gradlew build', {
|
||||
stdio: 'inherit',
|
||||
cwd: 'javaclient'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
while (running) {
|
||||
await main();
|
||||
}
|
||||
} catch (e) {
|
||||
if (e instanceof ExitPromptError) {
|
||||
process.exit(0);
|
||||
} else if (e instanceof Error) {
|
||||
if (e.message.startsWith('Command failed:')) {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
console.log(e.message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
// Environment setup & latest features
|
||||
"lib": ["ESNext"],
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleDetection": "force",
|
||||
"jsx": "react-jsx",
|
||||
"allowJs": true,
|
||||
|
||||
// Bundler mode
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"noEmit": true,
|
||||
|
||||
// Best practices
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
|
||||
// Some stricter flags (disabled by default)
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noPropertyAccessFromIndexSignature": false
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user