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

move to bun

This commit is contained in:
zumbiepig 2024-08-27 09:17:44 -07:00
parent 1edb684662
commit 0447d8a86c
No known key found for this signature in database
GPG Key ID: 17C891BE28B953DE
13 changed files with 114 additions and 3599 deletions

View File

@ -3,6 +3,8 @@ updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
interval: 'daily'
time: '00:00'
timezone: 'Etc/UTC'
commit-message:
prefix: 'dependabot'

View File

@ -1,6 +1,6 @@
name: Build
on: [push, pull_request, workflow_dispatch]
on: [push, pull_request]
jobs:
build:
@ -8,13 +8,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: 'package.json'
- name: Install bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
run: bun install --frozen-lockfile
- name: Build
run: npm run build
run: bun run build

75
.gitignore vendored
View File

@ -1,88 +1,113 @@
# Build artifacts
/public/assets.json
/public/resources/scripts/
/public/sw.js
/public/sw-full.js
package-lock.json
desktop.ini
# System files
.desktop.ini
.DS_Store
public/assets.json
public/resources/scripts/
public/sw.js
public/sw-full.js
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
_.log
npm-debug.log_
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Caches
.cache
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
# Runtime data
pids
*.pid
*.seed
_.pid
_.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
@ -90,51 +115,69 @@ web_modules/
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# IntelliJ based IDEs
.idea
# Finder (MacOS) folder config
.DS_Store

View File

@ -1,3 +1,7 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
"recommendations": [
"oven.bun-vscode",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}

View File

@ -1,7 +1,7 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, {
export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.strict, {
rules: {
'@typescript-eslint/ban-ts-comment': [
'error',

View File

@ -1,21 +0,0 @@
import { readdirSync, statSync, writeFileSync } from 'fs';
import { join } from 'path';
const directoryPath = join(import.meta.dirname, 'public');
function getFiles(dir, files_) {
files_ = files_ || [];
const files = readdirSync(dir);
for (let i in files) {
const name = dir + '/' + files[i];
if (statSync(name).isDirectory()) {
getFiles(name, files_);
} else {
files_.push(name.replace(`${import.meta.dirname}/public`, '').replace('/index.html', '/'));
}
}
return files_;
}
const assets = getFiles(directoryPath);
writeFileSync(join(import.meta.dirname, '/public/assets.json'), JSON.stringify(assets, null, 2));

21
generateAssetsList.ts Normal file
View File

@ -0,0 +1,21 @@
import { readdirSync, statSync, writeFileSync } from 'fs';
import { join } from 'path';
const directoryPath = join(import.meta.dir, 'public');
function getFiles(dir: string, filesArr?: string[]) {
filesArr = filesArr || [];
const files = readdirSync(dir);
for (const file of files) {
const name = join(dir, file);
if (statSync(name).isDirectory()) {
getFiles(name, filesArr);
} else {
filesArr.push(name.replace(new RegExp(`^${directoryPath}`), '').replace(/\/index\.html$/, '/'));
}
}
return filesArr;
}
const assets = getFiles(directoryPath);
writeFileSync(join(directoryPath, 'assets.json'), JSON.stringify(assets));

1
index.ts Normal file
View File

@ -0,0 +1 @@
console.log('Hello via Bun!');

3516
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +1,30 @@
{
"name": "minexlauncher",
"private": true,
"name": "minexlauncher",
"module": "index.ts",
"type": "module",
"main": "./server.js",
"scripts": {
"start": "node ./server.js",
"build": "npm run build:clean && npm run build:compile && npm run build:obfuscate && npm run build:generateAssetsList",
"start": "bun run ./index.ts",
"lint": "eslint ./src",
"lint:fix": "eslint --fix ./src",
"build": "bun run lint && bun run build:clean && bun run build:compile && bun run build:obfuscate && bun run generateAssetsList",
"build:clean": "rimraf ./public/resources/scripts ./public/assets.json",
"build:compile": "tsc",
"build:obfuscate": "javascript-obfuscator ./public/resources/scripts --output ./public/resources/scripts --options-preset high-obfuscation",
"build:generateAssetsList": "node ./generateAssetsList.js",
"lint": "eslint ./src",
"lint:fix": "eslint --fix ./src"
},
"engines": {
"node": "^20.0.0 || ^22.0.0"
"generateAssetsList": "bun run ./generateAssetsList.ts"
},
"dependencies": {
"express": "~4.19.2"
"@types/bun": "latest"
},
"devDependencies": {
"@eslint/js": "^9.9.1",
"@tsconfig/node20": "^20.1.4",
"@tsconfig/bun": "^1.0.7",
"@tsconfig/strictest": "^2.0.5",
"@types/eslint__js": "^8.42.3",
"eslint": "^8.57.0",
"eslint": "^9.9.1",
"javascript-obfuscator": "^4.1.1",
"rimraf": "^6.0.1",
"typescript": "^5.5.4",
"typescript-eslint": "^8.3.0"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
}

View File

@ -1,11 +0,0 @@
import express from 'express';
import path from 'path';
const app = express();
const port = process.env.PORT || 3000;
app.use(express.static(path.join(import.meta.dirname, 'public')));
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});

View File

@ -185,7 +185,6 @@ const cookie = {
},
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const storage = {
local: {
get: function (key: string) {
@ -214,7 +213,7 @@ const storage = {
const item = localStorage.getItem('minexlauncher');
if (item !== null) {
const json = JSON.parse(item);
delete json[key];
json[key] = undefined;
localStorage.setItem('minexlauncher', JSON.stringify(json));
}
},
@ -246,7 +245,7 @@ const storage = {
const item = sessionStorage.getItem('minexlauncher');
if (item !== null) {
const json = JSON.parse(item);
delete json[key];
json[key] = undefined;
sessionStorage.setItem('minexlauncher', JSON.stringify(json));
}
},

View File

@ -1,11 +1,11 @@
{
"extends": ["@tsconfig/node20/tsconfig", "@tsconfig/strictest/tsconfig"],
"extends": ["@tsconfig/bun", "@tsconfig/strictest"],
"compilerOptions": {
"moduleResolution": "bundler",
"module": "preserve",
"lib": ["es2023", "dom"],
"rootDir": "src",
"outDir": "public",
"moduleDetection": "auto",
"allowImportingTsExtensions": false,
"noEmit": false,
"removeComments": true
},
"include": ["src"]