Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions electron.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@ import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import { resolve } from 'path'
import { execSync } from 'child_process'

// Captured once at vite startup. Restart `npm run dev` after switching
// branches if you want the title to update.
function currentGitBranch(): string {
try {
return execSync('git rev-parse --abbrev-ref HEAD', {
cwd: __dirname,
stdio: ['pipe', 'pipe', 'ignore']
})
.toString()
.trim()
} catch {
return ''
}
}

const DEV_BRANCH = currentGitBranch()

export default defineConfig({
main: {
Expand Down Expand Up @@ -37,6 +55,9 @@ export default defineConfig({
},
renderer: {
plugins: [react(), tailwindcss()],
define: {
__HARNESS_DEV_BRANCH__: JSON.stringify(DEV_BRANCH)
},
build: {
ssr: false
}
Expand Down
7 changes: 6 additions & 1 deletion src/renderer/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,12 @@ export function Sidebar({
</svg>
{/* Title bar drag region with app name — vertically aligned with traffic lights at y:12 */}
<div className="drag-region h-10 relative shrink-0">
<span className="gradient-text text-xs font-semibold absolute left-20 top-[11px]">Harness</span>
<span className="absolute left-20 top-[11px] text-xs font-semibold whitespace-nowrap">
<span className="gradient-text">Harness</span>
{import.meta.env.DEV && __HARNESS_DEV_BRANCH__ && (
<span className="text-faint font-normal ml-1">({__HARNESS_DEV_BRANCH__})</span>
)}
</span>
</div>

{/* Command Center entry */}
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/// <reference types="vite/client" />

declare const __HARNESS_DEV_BRANCH__: string
Loading