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.
ca3a0a996a
...
293b422906
18
README.md
18
README.md
@ -1,16 +1,6 @@
|
|||||||
# MineXLauncher
|
# MineXLauncher
|
||||||
|
|
||||||
## Usage
|
### Update data in [updates.json](/public/resources/data/updates.json)
|
||||||
|
|
||||||
**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
|
## Client versions
|
||||||
|
|
||||||
@ -18,12 +8,10 @@
|
|||||||
- Offline preference order: Signed, International, en_US
|
- Offline preference order: Signed, International, en_US
|
||||||
- Do not update the index.html
|
- Do not update the index.html
|
||||||
|
|
||||||
(this list is outdated)
|
|
||||||
|
|
||||||
| Name | Version/commit | Date updated | Link |
|
| 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.9.4 | v0.7.0 | 07/24/2024 | [Gitea](https://git.zelz.net/Eagler-Lambda/hoosiertransfer-mod/releases) |
|
||||||
| 1.8.8 | auto updated using github actions |
|
| 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) |
|
| 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.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) |
|
| b1.3 | 23w49a | 07/24/2024 | [Eagler Archive](https://archive.eaglercraft.rip/Eaglercraft_b1.3/client/?sort=time&order=desc) |
|
||||||
|
76
build.ts
76
build.ts
@ -5,10 +5,11 @@ import {
|
|||||||
statSync,
|
statSync,
|
||||||
writeFileSync,
|
writeFileSync,
|
||||||
readFileSync,
|
readFileSync,
|
||||||
rmSync,
|
// rmSync,
|
||||||
} from 'fs';
|
} from 'fs';
|
||||||
import { resolve, dirname } from 'path';
|
import { resolve, dirname, basename } from 'path';
|
||||||
import { minify } from 'html-minifier';
|
import { minify } from 'html-minifier';
|
||||||
|
import javascriptObfuscator from 'javascript-obfuscator';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
|
|
||||||
function getFiles(baseDir: string, dir?: string, filesArr?: string[]) {
|
function getFiles(baseDir: string, dir?: string, filesArr?: string[]) {
|
||||||
@ -26,6 +27,7 @@ function getFiles(baseDir: string, dir?: string, filesArr?: string[]) {
|
|||||||
return filesArr;
|
return filesArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isDev = process.env.NODE_ENV === 'development' ? true : false;
|
||||||
const srcDir = resolve(import.meta.dir, 'src');
|
const srcDir = resolve(import.meta.dir, 'src');
|
||||||
const publicDir = resolve(
|
const publicDir = resolve(
|
||||||
import.meta.dir,
|
import.meta.dir,
|
||||||
@ -38,16 +40,22 @@ const copyFiles: string[] = [];
|
|||||||
srcFiles.forEach((file) => {
|
srcFiles.forEach((file) => {
|
||||||
const strippedPath = file.replace(new RegExp(`^${srcDir}`), '');
|
const strippedPath = file.replace(new RegExp(`^${srcDir}`), '');
|
||||||
if (file.endsWith('.ts')) bundleFiles.push(file);
|
if (file.endsWith('.ts')) bundleFiles.push(file);
|
||||||
else if (
|
else if (isDev) copyFiles.push(file);
|
||||||
/\.(?:html|css|js|json)$/.test(strippedPath) &&
|
else if (/\.(html|css|js|json)$/.test(strippedPath)) {
|
||||||
!/^\/game\/.*(?:\/offline\.html|\/classes\.js)$/.test(strippedPath)
|
if (
|
||||||
)
|
(strippedPath.startsWith('/game/') &&
|
||||||
minifyFiles.push(file);
|
strippedPath.endsWith('/offline.html')) ||
|
||||||
else copyFiles.push(file);
|
basename(strippedPath) === 'classes.js'
|
||||||
|
)
|
||||||
|
copyFiles.push(file);
|
||||||
|
else minifyFiles.push(file);
|
||||||
|
} else copyFiles.push(file);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(chalk.cyan('Removing old build artifacts...\n'));
|
/* if (!isDev) {
|
||||||
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'));
|
console.log(chalk.cyan('Bundling TypeScript and modules...\n'));
|
||||||
await build({
|
await build({
|
||||||
@ -62,21 +70,39 @@ await build({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(chalk.cyan('Minifying HTML, JS, CSS, and JSON...\n'));
|
if (!isDev) {
|
||||||
minifyFiles.forEach((file) => {
|
console.log(chalk.cyan('Minifying HTML, JS, CSS, and JSON...\n'));
|
||||||
const outputPath = file.replace(new RegExp(`^${srcDir}`), publicDir);
|
minifyFiles.forEach((file) => {
|
||||||
mkdirSync(dirname(outputPath), { recursive: true });
|
const outputPath = file.replace(new RegExp(`^${srcDir}`), publicDir);
|
||||||
writeFileSync(
|
mkdirSync(dirname(outputPath), { recursive: true });
|
||||||
outputPath,
|
writeFileSync(
|
||||||
minify(readFileSync(file, 'utf-8'), {
|
outputPath,
|
||||||
collapseWhitespace: true,
|
minify(readFileSync(file, 'utf-8'), {
|
||||||
removeComments: true,
|
collapseWhitespace: true,
|
||||||
minifyCSS: true,
|
removeComments: true,
|
||||||
minifyJS: true,
|
minifyCSS: true,
|
||||||
continueOnParseError: 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'));
|
console.log(chalk.cyan('Copying other files...\n'));
|
||||||
copyFiles.forEach((file) => {
|
copyFiles.forEach((file) => {
|
||||||
|
@ -4,17 +4,17 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "NODE_ENV=production bun run ./server.ts",
|
"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": "eslint ./src/resources/scripts/ && tsc",
|
||||||
"lint:fix": "eslint --fix ./src/resources/scripts/ && tsc",
|
"lint:fix": "eslint --fix ./src/resources/scripts/ && tsc",
|
||||||
"build": "NODE_ENV=production bun run ./build.ts",
|
"build": "NODE_ENV=production bun run ./build.ts",
|
||||||
|
"build:dev": "NODE_ENV=development bun run ./build.ts",
|
||||||
"format": "prettier --write --list-different .",
|
"format": "prettier --write --list-different .",
|
||||||
"format:check": "prettier --check .",
|
"format:check": "prettier --check .",
|
||||||
"proxy": "bun run ./proxy.ts",
|
"proxy": "bun run ./proxy.ts",
|
||||||
"proxy:build": "bun build ./proxy.ts --compile --minify --target=bun-linux-x64-modern --outfile ./proxy_linux-x64"
|
"proxy:build": "bun build ./proxy.ts --compile --minify --target=bun-linux-x64-modern --outfile ./proxy_linux-x64"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bun": "^1.1.29",
|
|
||||||
"chalk": "^5.3.0",
|
"chalk": "^5.3.0",
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.7.4",
|
||||||
"cookie-parser": "^1.4.6",
|
"cookie-parser": "^1.4.6",
|
||||||
@ -48,6 +48,7 @@
|
|||||||
"eslint": "^9.11.1",
|
"eslint": "^9.11.1",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"html-minifier": "^4.0.0",
|
"html-minifier": "^4.0.0",
|
||||||
|
"javascript-obfuscator": "^4.1.1",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"typescript": "^5.6.2",
|
"typescript": "^5.6.2",
|
||||||
"typescript-eslint": "^8.7.0"
|
"typescript-eslint": "^8.7.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user