mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-14 13:22:37 +00:00
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:
@@ -23,6 +23,10 @@ Desktop dev launches its desktop-managed daemon with `PASEO_NODE_ENV=development
|
||||
so development-only providers such as Mock Load Test are available. Packaged
|
||||
desktop launches always force the daemon to production mode.
|
||||
|
||||
The web and desktop dev launchers pass the current Git branch to Metro as
|
||||
`EXPO_PUBLIC_PASEO_DEV_BUILD_LABEL`. The expanded desktop sidebar shows it in
|
||||
the titlebar row. Production builds leave the variable unset and show no label.
|
||||
|
||||
`npm run dev` is only a shorthand for `npm run dev:server`. Keep `127.0.0.1:6767` for the packaged app and production-style `~/.paseo` state.
|
||||
|
||||
## Nix desktop package
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -12,6 +12,7 @@ configure_dev_paseo_home
|
||||
|
||||
EXPO_PORT="${EXPO_PORT:-8081}"
|
||||
DAEMON_ENDPOINT="$(resolve_dev_daemon_endpoint)"
|
||||
DEV_BUILD_LABEL="$(git -C "$ROOT_DIR" branch --show-current 2>/dev/null || true)"
|
||||
|
||||
echo "══════════════════════════════════════════════════════"
|
||||
echo " Paseo App Dev"
|
||||
@@ -24,5 +25,6 @@ echo "════════════════════════
|
||||
exec cross-env \
|
||||
BROWSER="${BROWSER:-none}" \
|
||||
APP_VARIANT=development \
|
||||
EXPO_PUBLIC_PASEO_DEV_BUILD_LABEL="$DEV_BUILD_LABEL" \
|
||||
EXPO_PUBLIC_LOCAL_DAEMON="$DAEMON_ENDPOINT" \
|
||||
npm run start:expo --workspace=@getpaseo/app -- --port "$EXPO_PORT"
|
||||
|
||||
@@ -50,6 +50,7 @@ $env:PASEO_CORS_ORIGINS = "*"
|
||||
# Configure the app to auto-connect to this daemon on localhost
|
||||
$env:APP_VARIANT = "development"
|
||||
$env:EXPO_PUBLIC_LOCAL_DAEMON = "localhost:6768"
|
||||
$env:EXPO_PUBLIC_PASEO_DEV_BUILD_LABEL = (git branch --show-current).Trim()
|
||||
$env:PASEO_LISTEN = "127.0.0.1:6768"
|
||||
$env:BROWSER = "none"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user