diff --git a/package.json b/package.json index 1abae257a1..25d883eaea 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,10 @@ { "scripts": { "gen": "concurrently \"prisma generate --no-hints\" \"prisma generate --no-hints --schema prisma/robochimp.prisma\" && echo \"Generated Prisma Client\"", - "lint": "concurrently \"prettier --use-tabs ./**/*.{js,md,json,yml} --write\" \"eslint --quiet *.{ts,mts} \"{src,tests}/**/*.ts\" --fix\"", + "prettify": "prettier --use-tabs ./**/*.{js,md,json,yml} --write", + "lint": "concurrently \"yarn prettify\" \"eslint --quiet *.{ts,mts} \"{src,tests}/**/*.ts\" --fix\"", "build:tsc": "tsc -p src", - "build": "concurrently \"yarn wipedist\" \"yarn gen\" && concurrently \"yarn prebuild:scripts\" && yarn build:tsc && yarn postbuild && echo \"Finished Building\"", + "build": "concurrently \"yarn wipedist\" \"yarn gen\" && yarn pre:build && yarn build:tsc && yarn post:build && echo \"Finished Building\"", "wipedist": "rimraf \"dist/\"", "start": "yarn build && concurrently \"tsc -w -p src\" \"node --enable-source-maps dist/\"", "test": "concurrently \"tsc -p src\" \"yarn test:lint\" \"yarn test:unit\"", @@ -12,8 +13,8 @@ "dev": "yarn wipedist && tsc -w -p src", "test:watch": "vitest --config vitest.unit.config.mts --coverage", "test:integration": "tsx ./src/scripts/integration-tests.ts", - "prebuild:scripts": "tsx ./src/scripts/render-creatables-file.ts", - "postbuild": "tsx ./src/scripts/postbuild.ts", + "pre:build": "tsx ./src/scripts/render-creatables-file.ts", + "post:build": "tsx ./src/scripts/postbuild.ts", "build:esbuild": "esbuild --bundle src/index.ts --outdir=dist --platform=node --loader:.node=file --external:canvas", "run:node": "node --enable-source-maps dist/index.js" }, diff --git a/src/index.ts b/src/index.ts index a22e554567..e211401a80 100644 --- a/src/index.ts +++ b/src/index.ts @@ -29,7 +29,6 @@ import { CACHED_ACTIVE_USER_IDS, syncActiveUserIDs } from './lib/util/cachedUser import { interactionHook } from './lib/util/globalInteractions'; import { handleInteractionError } from './lib/util/interactionReply'; import { logError } from './lib/util/logError'; -import { sonicBoom } from './lib/util/logger'; import { onStartup } from './mahoji/lib/events'; import { postCommand } from './mahoji/lib/postCommand'; import { preCommand } from './mahoji/lib/preCommand'; @@ -218,9 +217,4 @@ process.on('unhandledRejection', err => { logError(err); }); -process.on('exit', exitCode => { - sonicBoom.flushSync(); - debugLog('Process Exit', { type: 'PROCESS_EXIT', exitCode }); -}); - main(); diff --git a/src/scripts/postbuild.ts b/src/scripts/postbuild.ts index 1b11a688be..b1221ebdf6 100644 --- a/src/scripts/postbuild.ts +++ b/src/scripts/postbuild.ts @@ -1,5 +1,6 @@ import './no-prisma'; +import { execSync } from 'node:child_process'; import { join } from 'node:path'; import { stringMatches } from '@oldschoolgg/toolkit'; @@ -55,8 +56,10 @@ async function renderCommands() { } export async function main() { + console.log('Postbuild'); const commands = await renderCommands(); writeFileSync(`./src/lib/data/${BOT_TYPE.toLowerCase()}.commands.json`, JSON.stringify(commands, null, 4)); + execSync('yarn prettify'); } main().then(() => null); diff --git a/src/scripts/render-creatables-file.ts b/src/scripts/render-creatables-file.ts index 60e5b6fcaf..9253fd3833 100644 --- a/src/scripts/render-creatables-file.ts +++ b/src/scripts/render-creatables-file.ts @@ -8,6 +8,7 @@ import Createables from '../lib/data/createables'; import { makeTable } from '../lib/util/smallUtils'; export function main() { + console.log('Prebuild'); const headers = ['Item name', 'Input Items', 'Output Items', 'GP Cost']; const rows = Createables.map(i => { return [i.name, `${new Bank(i.inputItems)}`, `${new Bank(i.outputItems)}`, `${i.GPCost ?? 0}`];