Skip to content

Commit

Permalink
chore: bun
Browse files Browse the repository at this point in the history
  • Loading branch information
vwi committed Sep 15, 2023
1 parent 319cf6d commit 740fcd9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ coverage
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/
bin/
out/

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
Expand Down
Binary file modified bun.lockb
Binary file not shown.
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@
"run": "node .",
"dev": "cross-env disableFileLogs=true node --inspect=7000 -r ts-node/register ./src/sleepingServerStarter.ts ",
"prebuild": "rimraf ./build/ ./bin/ && cpx-fixed \"views/**/*.*\" build/views",
"build": "run-s build:typescript build:bin",
"build": "run-s build:bun build:bun-binary",
"build:typescript": "tsc",
"build:bin": "pkg build/sleepingServerStarter.js --config package.json --compress GZip --target node18-win-x64,node18-linux-x64,node18-linux-arm64,node18-macos-x64,node18-macos-arm64 --out-path ./bin/",
"build:bun": "bun build --target node --outdir ./out ./src/sleepingServerStarter.ts",
"build:bun-binary": "pkg out/sleepingServerStarter.js --config package.json --compress GZip --target node18-win-x64,node18-linux-x64,node18-linux-arm64,node18-macos-x64,node18-macos-arm64 --out-path ./bin/",
"test": "jest",
"lint": "eslint . --ext .ts --fix",
"format": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\""
},
"dependencies": {
"@jsprismarine/prismarine": "^0.1.0-rc.51",
"@jsprismarine/raknet": "^0.1.0-rc.51",
"@jsprismarine/prismarine": "0.1.0-rc.49",
"@jsprismarine/raknet": "0.1.0-rc.49",
"@sfirew/minecraft-motd-parser": "^1.1.1",
"express": "^4.18.2",
"express-handlebars": "^7.0.4",
Expand All @@ -36,6 +38,7 @@
"@types/serve-static": "^1.15.1",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"bun":"^1.0.1",
"cross-env": "7.0.3",
"cpx-fixed": "^1.6.0",
"eslint": "^8.37.0",
Expand Down
2 changes: 1 addition & 1 deletion src/sleepingBedrock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class SleepingBedrock implements ISleepingServer {
inetAddr: InetAddress
) => {
this.logger.info(`encapsulated ${JSON.stringify(inetAddr)}`);
const event = new RaknetEncapsulatedPacketEvent(inetAddr, packet);
const event = new RaknetEncapsulatedPacketEvent(inetAddr as any, packet);
await this.eventManager.emit("raknetEncapsulatedPacket", event);
};

Expand Down
5 changes: 2 additions & 3 deletions src/sleepingHelper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from "fs";
import path from "path";
import { createConnection } from "net";
import { autoToHtml, cleanTags } from "@sfirew/minecraft-motd-parser";
import { autoToHTML, cleanTags } from "@sfirew/minecraft-motd-parser";
import ChatMessage from "prismarine-chat";
import { LATEST_MINECRAFT_VERSION } from "./version";
import { getLogger } from "./sleepingLogger";
Expand Down Expand Up @@ -68,8 +68,7 @@ export const getMOTD = (

if (outputType === "html") {
// This automatically escapes any tags in the serverName to prevent XSS
// return autoToHtml(motd);
return motd;
return autoToHTML(motd);
}

return ChatMessage(settings.version || LATEST_MINECRAFT_VERSION)
Expand Down

0 comments on commit 740fcd9

Please sign in to comment.