1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-08 09:24:48 +00:00

Compare commits

..

No commits in common. "ca3a0a996a07dccf393d4a32c38e0efd7677b572" and "293b422906ce79746ce6f20c8a6ed0c67ad8c385" have entirely different histories.

4 changed files with 57 additions and 42 deletions

View File

@ -1,16 +1,6 @@
# MineXLauncher
## 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`
### Update data in [updates.json](/public/resources/data/updates.json)
## Client versions
@ -18,12 +8,10 @@
- Offline preference order: Signed, International, en_US
- Do not update the index.html
(this list is outdated)
| Name | Version/commit | Date updated | Link |
| ------------------ | --------------------------------- | ------------ | ----------------------------------------------------------------------------------------------- |
| 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.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.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,10 +5,11 @@ import {
statSync,
writeFileSync,
readFileSync,
rmSync,
// rmSync,
} from 'fs';
import { resolve, dirname } from 'path';
import { resolve, dirname, basename } from 'path';
import { minify } from 'html-minifier';
import javascriptObfuscator from 'javascript-obfuscator';
import chalk from 'chalk';
function getFiles(baseDir: string, dir?: string, filesArr?: string[]) {
@ -26,6 +27,7 @@ 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,
@ -38,16 +40,22 @@ const copyFiles: string[] = [];
srcFiles.forEach((file) => {
const strippedPath = file.replace(new RegExp(`^${srcDir}`), '');
if (file.endsWith('.ts')) bundleFiles.push(file);
else if (
/\.(?:html|css|js|json)$/.test(strippedPath) &&
!/^\/game\/.*(?:\/offline\.html|\/classes\.js)$/.test(strippedPath)
)
minifyFiles.push(file);
else copyFiles.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'
)
copyFiles.push(file);
else minifyFiles.push(file);
} else copyFiles.push(file);
});
console.log(chalk.cyan('Removing old build artifacts...\n'));
rmSync(publicDir, { force: true, recursive: true });
/* if (!isDev) {
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({
@ -62,21 +70,39 @@ await build({
},
});
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(
outputPath,
minify(readFileSync(file, 'utf-8'), {
collapseWhitespace: true,
removeComments: true,
minifyCSS: true,
minifyJS: true,
continueOnParseError: true,
}),
);
});
if (!isDev) {
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(
outputPath,
minify(readFileSync(file, 'utf-8'), {
collapseWhitespace: true,
removeComments: true,
minifyCSS: true,
minifyJS: true,
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 bun --hot run ./server.ts",
"dev": "NODE_ENV=development DEBUG=minexlauncher:* 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,6 +48,7 @@
"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"