diff --git a/lib/init/src/index.ts b/lib/init/src/index.ts index 653a896..ea92dff 100644 --- a/lib/init/src/index.ts +++ b/lib/init/src/index.ts @@ -49,7 +49,7 @@ function runCatching(fn: () => void) { // TODO(init): Move to use native module alert( // biome-ignore lint/style/useTemplate: I want this to be readable, thank you - `Failed to load Revenge (${__BUILD_COMMIT__}-${__BUILD_ENV__})\n` + + `Failed to load Revenge (v: ${__BUILD_VERSION__} c: ${__BUILD_COMMIT__} e: ${__BUILD_ENV__})\n` + `Discord: ${ClientInfoModule.Version} (${ClientInfoModule.Build})\n` + `Device: ${DeviceModule.deviceManufacturer} ${DeviceModule.deviceModel}\n\n` + getErrorStack(e), diff --git a/plugins/all.ts b/plugins/all.ts index da231b7..878500a 100644 --- a/plugins/all.ts +++ b/plugins/all.ts @@ -1,2 +1,2 @@ -import './timing-log' +import './logging' import './staff-settings' diff --git a/plugins/timing-log/index.ts b/plugins/logging/index.ts similarity index 65% rename from plugins/timing-log/index.ts rename to plugins/logging/index.ts index ffa4364..3ad0f3b 100644 --- a/plugins/timing-log/index.ts +++ b/plugins/logging/index.ts @@ -10,17 +10,21 @@ let tsInit: number registerPlugin( { - id: 'revenge.timing-log', - name: 'Startup Timing Log', - description: "Log Revenge's startup timing into Discord's Startup Timing", + id: 'revenge.logging', + name: 'Logging', + description: "Extra logging for Revenge's internal modules", + icon: 'PaperIcon', }, { init() { tsInit = performance.now() AppStartPerformance.mark('👊', 'Plugins init', tsInit - tsReg) }, - start() { + start({ logger }) { AppStartPerformance.mark('👊', 'Plugins start', performance.now() - tsInit) + logger.log( + `👊 Revenge. Discord, your way. (v: ${__BUILD_VERSION__} c: ${__BUILD_COMMIT__} e: ${__BUILD_ENV__})`, + ) }, }, PluginFlags.Enabled, diff --git a/scripts/build.ts b/scripts/build.ts index 2c31697..fe997ff 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -3,6 +3,8 @@ import { $, main } from 'bun' import chalk from 'chalk' import { type OutputChunk, type RolldownPlugin, rolldown } from 'rolldown' +import pkg from '../package.json' + // If this file is being run directly, build the project if (main === import.meta.filename) build() @@ -24,7 +26,8 @@ export default async function build(dev = false, log = true) { '.webp': 'dataurl', }, define: { - __BUILD_COMMIT__: JSON.stringify(await $`git rev-parse HEAD`.text()), + __BUILD_VERSION__: JSON.stringify(pkg.version), + __BUILD_COMMIT__: JSON.stringify((await $`git rev-parse HEAD`.text()).substring(0, 7)), __BUILD_ENV__: JSON.stringify(dev ? 'development' : 'production'), __BUILD_FLAG_INIT_DISABLE_PATCH_LOG_PROMISE_REJECTIONS__: String(!dev), }, diff --git a/types.d.ts b/types.d.ts index 3da0466..1d04eca 100644 --- a/types.d.ts +++ b/types.d.ts @@ -3,6 +3,7 @@ declare global { const __BUILD_ENV__: 'development' | 'production' const __BUILD_COMMIT__: string + const __BUILD_VERSION__: string const __BUILD_FLAG_INIT_DISABLE_PATCH_LOG_PROMISE_REJECTIONS__: boolean }