mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-07 23:24:48 +00:00
update
This commit is contained in:
parent
51a9d0f897
commit
5ba8d51aca
16
README.md
16
README.md
@ -1,6 +1,16 @@
|
|||||||
# MineXLauncher
|
# 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
|
## Client versions
|
||||||
|
|
||||||
@ -10,8 +20,8 @@
|
|||||||
|
|
||||||
| Name | Version/commit | Date updated | Link |
|
| 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.9.4 | v0.6.1 | 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.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) |
|
| 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,11 +5,10 @@ import {
|
|||||||
statSync,
|
statSync,
|
||||||
writeFileSync,
|
writeFileSync,
|
||||||
readFileSync,
|
readFileSync,
|
||||||
// rmSync,
|
rmSync,
|
||||||
} from 'fs';
|
} from 'fs';
|
||||||
import { resolve, dirname, basename } from 'path';
|
import { resolve, dirname } 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[]) {
|
||||||
@ -27,7 +26,6 @@ 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,
|
||||||
@ -40,22 +38,16 @@ 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 (isDev) copyFiles.push(file);
|
else if (
|
||||||
else if (/\.(html|css|js|json)$/.test(strippedPath)) {
|
/\.(?:html|css|js|json)$/.test(strippedPath) &&
|
||||||
if (
|
!/^\/game\/.*(?:\/offline\.html|\/classes\.js)$/.test(strippedPath)
|
||||||
(strippedPath.startsWith('/game/') &&
|
)
|
||||||
strippedPath.endsWith('/offline.html')) ||
|
minifyFiles.push(file);
|
||||||
basename(strippedPath) === 'classes.js'
|
else copyFiles.push(file);
|
||||||
)
|
|
||||||
copyFiles.push(file);
|
|
||||||
else minifyFiles.push(file);
|
|
||||||
} else copyFiles.push(file);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* if (!isDev) {
|
console.log(chalk.cyan('Removing old build artifacts...\n'));
|
||||||
console.log(chalk.cyan('Removing old build artifacts...\n'));
|
rmSync(publicDir, { force: true, recursive: true });
|
||||||
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({
|
||||||
@ -70,39 +62,21 @@ await build({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!isDev) {
|
console.log(chalk.cyan('Minifying HTML, JS, CSS, and JSON...\n'));
|
||||||
console.log(chalk.cyan('Minifying HTML, JS, CSS, and JSON...\n'));
|
minifyFiles.forEach((file) => {
|
||||||
minifyFiles.forEach((file) => {
|
const outputPath = file.replace(new RegExp(`^${srcDir}`), publicDir);
|
||||||
const outputPath = file.replace(new RegExp(`^${srcDir}`), publicDir);
|
mkdirSync(dirname(outputPath), { recursive: true });
|
||||||
mkdirSync(dirname(outputPath), { recursive: true });
|
writeFileSync(
|
||||||
writeFileSync(
|
outputPath,
|
||||||
outputPath,
|
minify(readFileSync(file, 'utf-8'), {
|
||||||
minify(readFileSync(file, 'utf-8'), {
|
collapseWhitespace: true,
|
||||||
collapseWhitespace: true,
|
removeComments: true,
|
||||||
removeComments: true,
|
minifyCSS: true,
|
||||||
minifyCSS: true,
|
minifyJS: true,
|
||||||
minifyJS: true,
|
continueOnParseError: 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 DEBUG=minexlauncher:* bun --hot run ./server.ts",
|
"dev": "NODE_ENV=development 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,7 +48,6 @@
|
|||||||
"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