mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 19:01:08 +02:00
feat(shared): add DevBuildBadge component and getBuildDefines() helper
- shared-vite-config: getBuildDefines() injects __BUILD_HASH__ and __BUILD_TIME__ as compile-time constants via Vite define - shared-ui: DevBuildBadge component shows git hash + build timestamp in a small fixed badge at bottom-right (click to expand) - Integrated into mukke-web for deployment verification Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
511b51e372
commit
822e75368a
6 changed files with 105 additions and 2 deletions
|
|
@ -3,6 +3,7 @@
|
|||
* Provides consistent SSR and optimization settings.
|
||||
*/
|
||||
|
||||
import { execSync } from 'child_process';
|
||||
import type { UserConfig, UserConfigExport } from 'vite';
|
||||
|
||||
/**
|
||||
|
|
@ -34,6 +35,24 @@ export const MANACORE_SHARED_PACKAGES = [
|
|||
'@manacore/shared-help-ui',
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* Get build-time defines for version tracking.
|
||||
* Injects __BUILD_HASH__ and __BUILD_TIME__ as compile-time constants.
|
||||
*/
|
||||
export function getBuildDefines(): Record<string, string> {
|
||||
let commitHash = 'dev';
|
||||
try {
|
||||
commitHash = execSync('git rev-parse --short HEAD').toString().trim();
|
||||
} catch {
|
||||
// fallback if not in a git repo
|
||||
}
|
||||
const buildTime = new Date().toISOString();
|
||||
return {
|
||||
__BUILD_HASH__: JSON.stringify(commitHash),
|
||||
__BUILD_TIME__: JSON.stringify(buildTime),
|
||||
};
|
||||
}
|
||||
|
||||
export interface ViteConfigOptions {
|
||||
/** Server port */
|
||||
port: number;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue