Show the source branch on development builds (#3216)

Development web and Electron builds now show their source branch in the expanded sidebar, including a branch icon and safe truncation. Dev launchers inject the label at build time; production builds remain unchanged.
This commit is contained in:
Mohamed Boudra
2026-08-11 14:18:06 +02:00
committed by GitHub
parent 8c003351d0
commit 917e39495b
6 changed files with 50 additions and 2 deletions
+36 -1
View File
@@ -2,6 +2,7 @@ import { router, usePathname } from "expo-router";
import {
CalendarClock,
FolderPlus,
GitBranch,
History,
Home,
Plus,
@@ -77,6 +78,8 @@ import { SidebarWorkspaceList } from "./sidebar-workspace-list";
type SidebarTheme = ReturnType<typeof useUnistyles>["theme"];
const DEV_BUILD_LABEL = process.env.EXPO_PUBLIC_PASEO_DEV_BUILD_LABEL?.trim() || null;
interface SidebarSharedProps {
theme: SidebarTheme;
statusGroups: StatusGroup[];
@@ -853,9 +856,22 @@ function DesktopSidebar({
>
<View style={desktopSidebarBorderStyle}>
<View style={styles.sidebarDragArea}>
{ownsTopLeft ? (
{ownsTopLeft || DEV_BUILD_LABEL ? (
<View style={styles.desktopChromeRow}>
<TitlebarDragRegion />
{DEV_BUILD_LABEL ? (
<View
pointerEvents="none"
style={styles.devBuildBadge}
testID="dev-build-label"
accessibilityLabel={`Development build: ${DEV_BUILD_LABEL}`}
>
<GitBranch size={12} color={theme.colors.accentForeground} />
<Text numberOfLines={1} ellipsizeMode="tail" style={styles.devBuildBadgeText}>
{DEV_BUILD_LABEL}
</Text>
</View>
) : null}
</View>
) : (
<TitlebarDragRegion />
@@ -1080,9 +1096,28 @@ const styles = StyleSheet.create((theme) => ({
height: HEADER_INNER_HEIGHT,
flexDirection: "row",
alignItems: "center",
justifyContent: "flex-end",
paddingHorizontal: theme.spacing[3],
borderBottomWidth: theme.borderWidth[1],
borderBottomColor: "transparent",
},
devBuildBadge: {
maxWidth: "60%",
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[1],
paddingHorizontal: theme.spacing[2],
paddingVertical: 2,
borderRadius: theme.borderRadius.full,
backgroundColor: theme.colors.accent,
},
devBuildBadgeText: {
minWidth: 0,
flexShrink: 1,
color: theme.colors.accentForeground,
fontSize: theme.fontSize.xs,
fontWeight: theme.fontWeight.medium,
},
sidebarFooter: {
flexDirection: "row",
alignItems: "center",
+6 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import net from "node:net";
import path from "node:path";
import { spawn } from "node:child_process";
import { execFileSync, spawn } from "node:child_process";
import { createRequire } from "node:module";
import { fileURLToPath } from "node:url";
import { createElectronSpawnOptions, resolveChildKillTarget } from "./dev-runner-config.mjs";
@@ -27,6 +27,10 @@ const colorEnv = {
FORCE_COLOR: process.env.FORCE_COLOR || "1",
npm_config_color: process.env.npm_config_color || "always",
};
const devBuildLabel = execFileSync("git", ["branch", "--show-current"], {
cwd: rootDir,
encoding: "utf8",
}).trim();
const children = new Map();
let stopping = false;
@@ -166,6 +170,7 @@ spawnChild("metro", "npx", ["expo", "start", "--port", String(expoPort)], {
...colorEnv,
BROWSER: "none",
APP_VARIANT: "development",
EXPO_PUBLIC_PASEO_DEV_BUILD_LABEL: devBuildLabel,
PASEO_WEB_PLATFORM: "electron",
},
});
+1
View File
@@ -32,6 +32,7 @@ try {
# Set EXPO_DEV_URL in the environment so Electron inherits it
$env:EXPO_DEV_URL = "http://localhost:$($env:EXPO_PORT)"
$env:EXPO_PUBLIC_PASEO_DEV_BUILD_LABEL = (git -C $RootDir branch --show-current).Trim()
$env:PASEO_DEV_ROOT = $RootDir
$env:PASEO_DEV_RUNTIME_FALLBACK_ROOT = $RootDir