This commit is contained in:
Kim Ravn Hansen
2025-09-15 11:28:25 +02:00
parent 58c48fdc4b
commit c19557ba33
19 changed files with 1546 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
import { crackdown } from "./crackdown.js"; import { crackdown } from "../utils/crackdown.js";
import { parseArgs } from "./parseArgs.js"; import { parseArgs } from "../utils/parseArgs.js";
import { MessageType } from "./messages.js"; import { MessageType } from "../utils/messages.js";
/** Regex to validate if a :help [topic] command i entered correctly */ /** Regex to validate if a :help [topic] command i entered correctly */
const helpRegex = /^:help(?:\s+(.*))?$/; const helpRegex = /^:help(?:\s+(.*))?$/;

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

Before

Width:  |  Height:  |  Size: 448 KiB

After

Width:  |  Height:  |  Size: 448 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

Before

Width:  |  Height:  |  Size: 783 B

After

Width:  |  Height:  |  Size: 783 B

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

32
server/frontend/index.html Executable file
View File

@@ -0,0 +1,32 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WebSocket MUD</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="stylesheet" href="style.sass" />
<link rel="manifest" href="manifest.json" />
<lin rel="icon" href="favicon.ico" />
</head>
<body>
<div id="container">
<div id="status" class="connecting">Connecting...</div>
<div id="output"></div>
<div id="input-container">
<input
type="text"
autocomplete="off"
id="input"
placeholder="Enter command..."
disabled
autocorrect="off"
autocomplete="off"
/>
</div>
</div>
<script type="module" src="client.js"></script>
</body>
</html>

View File

@@ -26,20 +26,20 @@ body {
overflow: hidden; overflow: hidden;
} }
#output { /* #output { */
flex: 1; /* flex: 1; */
background-color: #000; /* background-color: #000; */
border: 2px solid #333; /* border: 2px solid #333; */
padding: 15px; /* padding: 15px; */
overflow-y: auto; /* overflow-y: auto; */
white-space: pre-wrap; /* white-space: pre-wrap; */
line-height: 1.4; /* line-height: 1.4; */
margin-bottom: 20px; /* margin-bottom: 20px; */
font-family: "Fira Code", monospace; /* font-family: "Fira Code", monospace; */
font-optical-sizing: auto; /* font-optical-sizing: auto; */
font-size: 14px; /* font-size: 14px; */
width: 100ch; /* width: 100ch; */
} /* } */
#input-container { #input-container {
display: flex; display: flex;

14
server/frontend/test.scss Executable file
View File

@@ -0,0 +1,14 @@
#output {
flex: 1;
background-color: #000;
border: 2px solid #333;
padding: 15px;
overflow-y: auto;
white-space: pre-wrap;
line-height: 1.4;
margin-bottom: 20px;
font-family: "Fira Code", monospace;
font-optical-sizing: auto;
font-size: 14px;
width: 100ch;
}

8
server/frontend/vite.config.js Executable file
View File

@@ -0,0 +1,8 @@
export default {
root: ".",
build: {
outDir: "../public/",
emptyOutDir: true, // also necessary
sourcemap: "inline",
},
};

1467
server/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,8 +8,9 @@
"server:start": "MUUHD_ENV=prod node server.js", "server:start": "MUUHD_ENV=prod node server.js",
"server:dev": "MUUHD_ENV=dev nodemon server.js", "server:dev": "MUUHD_ENV=dev nodemon server.js",
"frontend:build": "vite build frontend", "frontend:build": "vite build frontend",
"frontend:dev": "vite frontend" "frontend:dev": "vite frontend",
"dev": "concurrently \"npm run server:dev\" \"npm run frontend:dev\"", "dev": "concurrently 'npm run server:dev' 'npm run frontend:dev'",
"dev:color": "concurrently -n 'API,UI' -c 'blue,green' 'npm run server:dev' 'npm run frontend:dev'"
}, },
"keywords": [ "keywords": [
"mud", "mud",
@@ -27,7 +28,9 @@
"devDependencies": { "devDependencies": {
"concurrently": "^9.2.1", "concurrently": "^9.2.1",
"nodemon": "^3.0.1", "nodemon": "^3.0.1",
"prettier": "3.6.2" "prettier": "3.6.2",
"sass-embedded": "^1.92.1",
"vite": "^7.1.5"
}, },
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=14.0.0"

6
server/public/index.html Executable file → Normal file
View File

@@ -6,8 +6,9 @@
<title>WebSocket MUD</title> <title>WebSocket MUD</title>
<link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="stylesheet" href="style.css" /> <link rel="manifest" href="/assets/manifest-BwHFeIBa.json" />
<link rel="manifest" href="manifest.json" /> <script type="module" crossorigin src="/assets/index-Dz3BJtZ6.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DHjAscAP.css">
</head> </head>
<body> <body>
<div id="container"> <div id="container">
@@ -26,6 +27,5 @@
</div> </div>
</div> </div>
<script type="module" src="client.js"></script>
</body> </body>
</html> </html>

View File

@@ -1 +0,0 @@
../utils/messages.js

View File

@@ -1 +0,0 @@
../utils/mustbe.js

View File

View File