From bee745e0d51d77f62e69dbfc65ee4abb7ee6a2e0 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Wed, 30 Apr 2025 20:21:59 +0700 Subject: [PATCH] feat: make use of `__BUILD_*__` globals --- lib/init/src/index.ts | 2 +- scripts/build.ts | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/init/src/index.ts b/lib/init/src/index.ts index 8f09ed9..f6e9275 100644 --- a/lib/init/src/index.ts +++ b/lib/init/src/index.ts @@ -48,7 +48,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!\n' + + `Failed to load Revenge (${__BUILD_COMMIT__}-${__BUILD_ENV__})\n` + `Discord: ${ClientInfoModule.Version} (${ClientInfoModule.Build})\n` + `Device: ${DeviceModule.deviceManufacturer} ${DeviceModule.deviceModel}\n\n` + getErrorStack(e), diff --git a/scripts/build.ts b/scripts/build.ts index 4119db0..2c31697 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -1,8 +1,7 @@ import { transform } from '@swc/core' -import { main } from 'bun' +import { $, main } from 'bun' import chalk from 'chalk' import { type OutputChunk, type RolldownPlugin, rolldown } from 'rolldown' -import tsconfigPaths from 'rollup-plugin-tsconfig-paths' // If this file is being run directly, build the project if (main === import.meta.filename) build() @@ -25,7 +24,7 @@ export default async function build(dev = false, log = true) { '.webp': 'dataurl', }, define: { - __BUILD_COMMIT__: JSON.stringify(''), + __BUILD_COMMIT__: JSON.stringify(await $`git rev-parse HEAD`.text()), __BUILD_ENV__: JSON.stringify(dev ? 'development' : 'production'), __BUILD_FLAG_INIT_DISABLE_PATCH_LOG_PROMISE_REJECTIONS__: String(!dev), },