feat: make use of __BUILD_*__ globals

This commit is contained in:
PalmDevs 2025-04-30 20:21:59 +07:00
parent b1315f1ebf
commit bee745e0d5
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA
2 changed files with 3 additions and 4 deletions

View file

@ -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),

View file

@ -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),
},