1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-07 23:24:48 +00:00
This commit is contained in:
zumbiepig 2024-09-27 16:58:59 -07:00
parent 51a9d0f897
commit 5ba8d51aca
No known key found for this signature in database
GPG Key ID: 17C891BE28B953DE
4 changed files with 40 additions and 57 deletions

View File

@ -1,6 +1,16 @@
# MineXLauncher
### Update data in [updates.json](/public/resources/data/updates.json)
## Usage
**Prerequisites:**
- bun installed (install using `npm install --global bun`)
**Steps:**
1. Install packages: `bun install --frozen-lockfile`
2. Build: `bun run build`
3. Run server: `PORT=3000 bun run start`
## Client versions
@ -10,8 +20,8 @@
| Name | Version/commit | Date updated | Link |
| ------------------ | --------------------------------- | ------------ | ----------------------------------------------------------------------------------------------- |
| 1.9.4 | v0.7.0 | 07/24/2024 | [Gitea](https://git.zelz.net/Eagler-Lambda/hoosiertransfer-mod/releases) |
| 1.8.8 | u35 | 07/24/2024 | [Eagler Archive](https://archive.eaglercraft.rip/EaglercraftX_1.8/client/?sort=time&order=desc) |
| 1.9.4 | v0.6.1 | 07/24/2024 | [Gitea](https://git.zelz.net/Eagler-Lambda/hoosiertransfer-mod/releases) |
| 1.8.8 | auto updated using github actions |
| 1.5.2 | sp1.01 | 07/24/2024 | [Eagler Archive](https://archive.eaglercraft.rip/Eaglercraft_1.5/client/?sort=time&order=desc) |
| b1.7.3 | `38809105d2` | 09/07/2024 | [Gitea](https://git.eaglercraft.rip/3rdparty/peytonplayz585-b1.7.3) |
| b1.3 | 23w49a | 07/24/2024 | [Eagler Archive](https://archive.eaglercraft.rip/Eaglercraft_b1.3/client/?sort=time&order=desc) |

View File

@ -5,11 +5,10 @@ import {
statSync,
writeFileSync,
readFileSync,
// rmSync,
rmSync,
} from 'fs';
import { resolve, dirname, basename } from 'path';
import { resolve, dirname } from 'path';
import { minify } from 'html-minifier';
import javascriptObfuscator from 'javascript-obfuscator';
import chalk from 'chalk';
function getFiles(baseDir: string, dir?: string, filesArr?: string[]) {
@ -27,7 +26,6 @@ function getFiles(baseDir: string, dir?: string, filesArr?: string[]) {
return filesArr;
}
const isDev = process.env.NODE_ENV === 'development' ? true : false;
const srcDir = resolve(import.meta.dir, 'src');
const publicDir = resolve(
import.meta.dir,
@ -40,22 +38,16 @@ const copyFiles: string[] = [];
srcFiles.forEach((file) => {
const strippedPath = file.replace(new RegExp(`^${srcDir}`), '');
if (file.endsWith('.ts')) bundleFiles.push(file);
else if (isDev) copyFiles.push(file);
else if (/\.(html|css|js|json)$/.test(strippedPath)) {
if (
(strippedPath.startsWith('/game/') &&
strippedPath.endsWith('/offline.html')) ||
basename(strippedPath) === 'classes.js'
else if (
/\.(?:html|css|js|json)$/.test(strippedPath) &&
!/^\/game\/.*(?:\/offline\.html|\/classes\.js)$/.test(strippedPath)
)
copyFiles.push(file);
else minifyFiles.push(file);
} else copyFiles.push(file);
minifyFiles.push(file);
else copyFiles.push(file);
});
/* if (!isDev) {
console.log(chalk.cyan('Removing old build artifacts...\n'));
rmSync(publicDir, { force: true, recursive: true });
} */
console.log(chalk.cyan('Removing old build artifacts...\n'));
rmSync(publicDir, { force: true, recursive: true });
console.log(chalk.cyan('Bundling TypeScript and modules...\n'));
await build({
@ -70,9 +62,8 @@ await build({
},
});
if (!isDev) {
console.log(chalk.cyan('Minifying HTML, JS, CSS, and JSON...\n'));
minifyFiles.forEach((file) => {
console.log(chalk.cyan('Minifying HTML, JS, CSS, and JSON...\n'));
minifyFiles.forEach((file) => {
const outputPath = file.replace(new RegExp(`^${srcDir}`), publicDir);
mkdirSync(dirname(outputPath), { recursive: true });
writeFileSync(
@ -85,24 +76,7 @@ if (!isDev) {
continueOnParseError: true,
}),
);
});
console.log(chalk.cyan('Obfuscating JavaScript...\n'));
bundleFiles.forEach((file) => {
const outputPath = file
.replace(new RegExp(`^${srcDir}`), publicDir)
.replace(/\.ts$/, '.js');
writeFileSync(
outputPath,
javascriptObfuscator
.obfuscate(readFileSync(outputPath, 'utf-8'), {
//optionsPreset: 'medium-obfuscation',
target: 'browser',
})
.getObfuscatedCode(),
);
});
}
});
console.log(chalk.cyan('Copying other files...\n'));
copyFiles.forEach((file) => {

BIN
bun.lockb

Binary file not shown.

View File

@ -4,17 +4,17 @@
"type": "module",
"scripts": {
"start": "NODE_ENV=production bun run ./server.ts",
"dev": "NODE_ENV=development DEBUG=minexlauncher:* bun --hot run ./server.ts",
"dev": "NODE_ENV=development bun --hot run ./server.ts",
"lint": "eslint ./src/resources/scripts/ && tsc",
"lint:fix": "eslint --fix ./src/resources/scripts/ && tsc",
"build": "NODE_ENV=production bun run ./build.ts",
"build:dev": "NODE_ENV=development bun run ./build.ts",
"format": "prettier --write --list-different .",
"format:check": "prettier --check .",
"proxy": "bun run ./proxy.ts",
"proxy:build": "bun build ./proxy.ts --compile --minify --target=bun-linux-x64-modern --outfile ./proxy_linux-x64"
},
"dependencies": {
"bun": "^1.1.29",
"chalk": "^5.3.0",
"compression": "^1.7.4",
"cookie-parser": "^1.4.6",
@ -48,7 +48,6 @@
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"html-minifier": "^4.0.0",
"javascript-obfuscator": "^4.1.1",
"prettier": "^3.3.3",
"typescript": "^5.6.2",
"typescript-eslint": "^8.7.0"