1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-08 09:24:48 +00:00
This commit is contained in:
zumbiepig 2024-08-31 08:14:02 -07:00
parent 2f1f532df5
commit 583617d8df
No known key found for this signature in database
GPG Key ID: 17C891BE28B953DE
9 changed files with 30 additions and 18 deletions

View File

@ -4,8 +4,8 @@ import { join } from 'path';
import chalk from 'chalk'; import chalk from 'chalk';
function getFiles(baseDir: string, dir?: string, filesArr?: string[]) { function getFiles(baseDir: string, dir?: string, filesArr?: string[]) {
dir = dir || baseDir; dir = dir ?? baseDir;
filesArr = filesArr || []; filesArr = filesArr ?? [];
const files = readdirSync(dir); const files = readdirSync(dir);
for (const file of files) { for (const file of files) {
const name = join(dir, file); const name = join(dir, file);
@ -18,6 +18,8 @@ function getFiles(baseDir: string, dir?: string, filesArr?: string[]) {
return filesArr; return filesArr;
} }
console.clear();
console.log(chalk.cyan('Linting code...\n')); console.log(chalk.cyan('Linting code...\n'));
const lintOutput = await $`bunx eslint ./src/`.nothrow().text(); const lintOutput = await $`bunx eslint ./src/`.nothrow().text();
if (lintOutput) { if (lintOutput) {
@ -25,6 +27,13 @@ if (lintOutput) {
process.exit(1); process.exit(1);
} }
console.log(chalk.cyan('Type-checking code...\n'));
const tscOutput = await $`bunx tsc`.nothrow().text();
if (tscOutput) {
console.error(tscOutput);
process.exit(1);
}
console.log(chalk.cyan('Removing old build artifacts...\n')); console.log(chalk.cyan('Removing old build artifacts...\n'));
await $`rm -rf ./public/resources/scripts/ ./public/assets.json ./public/sw.js ./public/sw-full.js`.quiet(); await $`rm -rf ./public/resources/scripts/ ./public/assets.json ./public/sw.js ./public/sw-full.js`.quiet();

BIN
bun.lockb

Binary file not shown.

View File

@ -4,15 +4,24 @@ import tseslint from 'typescript-eslint';
export default tseslint.config( export default tseslint.config(
eslint.configs.recommended, eslint.configs.recommended,
...tseslint.configs.strict, ...tseslint.configs.strict,
...tseslint.configs.stylisticTypeChecked,
{ {
languageOptions: {
parserOptions: {
projectService: true,
project: './tsconfig.json',
tsconfigRootDir: import.meta.dirname,
},
},
rules: { rules: {
'@typescript-eslint/ban-ts-comment': [ '@typescript-eslint/ban-ts-comment': [
'error', { 'error',
{
'ts-expect-error': false, 'ts-expect-error': false,
'ts-nocheck': false, 'ts-nocheck': false,
'ts-check': true, 'ts-check': true,
}, },
], ],
}, },
} },
); );

View File

@ -1,3 +1,4 @@
// @ts-nocheck
import { join } from 'path'; import { join } from 'path';
import { env } from 'bun'; import { env } from 'bun';
import express, { json, urlencoded } from 'express'; import express, { json, urlencoded } from 'express';
@ -14,7 +15,7 @@ import serveStatic from 'serve-static';
import { indexRouter } from './routes/index.ts'; import { indexRouter } from './routes/index.ts';
const BASE_DIR = join(import.meta.dir, 'public'); const BASE_DIR = join(import.meta.dir, 'public');
const PORT = env.PORT || 3000; const PORT = env.PORT ?? 3000;
const debugLogger = debug('app:server'); const debugLogger = debug('app:server');
const isDev = env.NODE_ENV === 'development'; const isDev = env.NODE_ENV === 'development';

View File

@ -29,6 +29,7 @@
"@types/compression": "^1.7.5", "@types/compression": "^1.7.5",
"@types/debug": "^4.1.12", "@types/debug": "^4.1.12",
"@types/errorhandler": "^1.5.3", "@types/errorhandler": "^1.5.3",
"@types/eslint__js": "^8.42.3",
"@types/morgan": "^1.9.9", "@types/morgan": "^1.9.9",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@types/serve-favicon": "^2.5.7", "@types/serve-favicon": "^2.5.7",

View File

@ -1,3 +1,4 @@
// @ts-nocheck
import { Router } from 'express'; import { Router } from 'express';
const indexRouter = Router(); const indexRouter = Router();

View File

@ -330,9 +330,8 @@ if (window.location.pathname === '/') {
googleAdsPush.text = '(adsbygoogle = window.adsbygoogle || []).push({});'; googleAdsPush.text = '(adsbygoogle = window.adsbygoogle || []).push({});';
document.body.appendChild(googleAdsPush); document.body.appendChild(googleAdsPush);
const adsContainers = document.getElementsByClassName('ads-container'); const adsContainers = Array.from(document.getElementsByClassName('ads-container')) as HTMLElement[];
for (let i = 0; i < adsContainers.length; i++) { for (const adsContainer of adsContainers) {
const adsContainer = adsContainers[i] as HTMLElement;
adsContainer.style.display = 'flex'; adsContainer.style.display = 'flex';
} }
}); });

View File

@ -53,7 +53,7 @@ self.addEventListener('activate', (event) => {
self.addEventListener('fetch', (event) => { self.addEventListener('fetch', (event) => {
event.respondWith( event.respondWith(
caches.match(event.request).then((response) => { caches.match(event.request).then((response) => {
return response || fetch(event.request); return response ?? fetch(event.request);
}) })
); );
}); });

View File

@ -1,12 +1,4 @@
{ {
"extends": ["@tsconfig/bun", "@tsconfig/strictest"], "extends": ["@tsconfig/bun", "@tsconfig/strictest"],
"compilerOptions": { "exclude": ["node_modules", "public"]
"rootDir": "src",
"outDir": "public",
"moduleDetection": "auto",
"allowImportingTsExtensions": false,
"noEmit": false,
"removeComments": true
},
"include": ["src"]
} }