From 4d5d8bf846b61c685f9a06254b85fe669121be28 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Mon, 22 Sep 2025 17:33:11 -0600 Subject: [PATCH] show hash in the console --- apps/web/src/context/AppVersion/useAppVersion.tsx | 1 - .../src/context/AppVersion/useWelcomeConsole.tsx | 15 +++++++++++++++ .../src/context/Posthog/BusterPosthogProvider.tsx | 12 +----------- apps/web/src/context/Providers.tsx | 7 ++++++- 4 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 apps/web/src/context/AppVersion/useWelcomeConsole.tsx diff --git a/apps/web/src/context/AppVersion/useAppVersion.tsx b/apps/web/src/context/AppVersion/useAppVersion.tsx index e5e8412df..a63873a59 100644 --- a/apps/web/src/context/AppVersion/useAppVersion.tsx +++ b/apps/web/src/context/AppVersion/useAppVersion.tsx @@ -29,7 +29,6 @@ export const useAppVersion = () => { }); useEffect(() => { - console.log('isChanged', data?.buildId, browserBuild); if (isChanged) { openInfoNotification({ duration: Infinity, diff --git a/apps/web/src/context/AppVersion/useWelcomeConsole.tsx b/apps/web/src/context/AppVersion/useWelcomeConsole.tsx new file mode 100644 index 000000000..b70820ac4 --- /dev/null +++ b/apps/web/src/context/AppVersion/useWelcomeConsole.tsx @@ -0,0 +1,15 @@ +import { useMount } from '@/hooks/useMount'; +import { formatDate } from '@/lib/date'; + +export const useWelcomeConsole = () => { + useMount(() => { + console.log( + `%c🚀 Welcome to Buster #${import.meta.env.VITE_BUILD_ID}`, + 'background: linear-gradient(to right, #a21caf, #8b1cb1, #6b21a8); color: white; font-size: 16px; font-weight: bold; padding: 10px; border-radius: 5px;' + ); + console.log( + `%c🐛 Found a bug? The code is open-source! Report it at https://github.com/buster-so/buster or send a PR! 🚀 • This version was deployed at ${formatDate({ date: import.meta.env.VITE_BUILD_AT, format: 'LLLL' })}`, + 'background: #6b21a8; color: white !important; font-size: 10px; font-weight: 500; padding: 8px 12px; border-radius: 5px; text-decoration: none; --webkit-text-fill-color: white; --webkit-text-stroke-color: white;' + ); + }); +}; diff --git a/apps/web/src/context/Posthog/BusterPosthogProvider.tsx b/apps/web/src/context/Posthog/BusterPosthogProvider.tsx index 480e798b0..55bba1fe5 100644 --- a/apps/web/src/context/Posthog/BusterPosthogProvider.tsx +++ b/apps/web/src/context/Posthog/BusterPosthogProvider.tsx @@ -10,6 +10,7 @@ import { import { ComponentErrorCard } from '@/components/features/global/ComponentErrorCard'; import { isDev } from '@/config/dev'; import { env } from '@/env'; +import { useMount } from '@/hooks/useMount'; import packageJson from '../../../package.json'; const version = packageJson.version; @@ -37,17 +38,6 @@ const options: Partial = { session_recording: { recordBody: true, }, - - loaded: () => { - console.log( - `%c🚀 Welcome to Buster v${version}`, - 'background: linear-gradient(to right, #a21caf, #8b1cb1, #6b21a8); color: white; font-size: 16px; font-weight: bold; padding: 10px; border-radius: 5px;' - ); - console.log( - '%cBuster is your open-source data analytics platform. Found a bug? The code is open-source! Report it at https://github.com/buster-so/buster. Better yet, fix it yourself and send a PR.', - 'background: #6b21a8; color: white; font-size: 10px; font-weight: normal; padding: 8px; border-radius: 4px;' - ); - }, }; const PosthogWrapper: React.FC = ({ children }) => { diff --git a/apps/web/src/context/Providers.tsx b/apps/web/src/context/Providers.tsx index 31e313481..81a960da5 100644 --- a/apps/web/src/context/Providers.tsx +++ b/apps/web/src/context/Providers.tsx @@ -1,7 +1,9 @@ import type React from 'react'; import type { PropsWithChildren } from 'react'; +import { isDev } from '@/config/dev'; import { BusterPosthogProvider } from '@/context/Posthog'; import { useAppVersion } from './AppVersion/useAppVersion'; +import { useWelcomeConsole } from './AppVersion/useWelcomeConsole'; import { BusterStyleProvider } from './BusterStyles'; import { SupabaseContextProvider, @@ -16,7 +18,10 @@ export const AppProviders: React.FC> = ({ children, supabaseSession, }) => { - useAppVersion(); + if (!isDev) { + useAppVersion(); + useWelcomeConsole(); + } return (