Files
zeekayandHanzo Dev c24e700a18 feat(desktop): complete 100% Tauri v2 migration, native SnapShot/SSH/updater/CLI/preview, standalone bundles & CI
Finishes migrating Hanzo Dev off Electron to native Rust Tauri v2:
- Native Rust SnapShot capture (snapshot.rs), direct SSH port-forward supervisor (ssh.rs), GitHub release updater, ~/.local/bin/hanzo-dev-app CLI installer, global shortcuts (CmdOrCtrl+Shift+I/J/2), macOS Dock Reopen restore, and Tauri preview iframe host.
- Self-contained .app/.dmg/.AppImage/.exe/.msi resource staging via apps/desktop/scripts/stage-tauri-resources.mjs + tauri.conf.json.
- Migrates all GitHub Actions CI & release workflows (.github/workflows/*) to Rust + Tauri v2 and purges all @electron/* dependencies and legacy Electron packaging scripts.
- Cleans unused web/mobile deps so knip passes with zero issues across all 43 workspaces.

Co-authored-by: Hanzo Dev <[email protected]>
2026-11-19 11:37:00 -08:00

90 lines
2.9 KiB
TypeScript

export type StagePlatform = "mac" | "linux" | "win";
export type StageArch = "arm64" | "x64" | "universal";
export const STAGE_INSTALL_ARGS = ["install", "--prod"] as const;
export interface StageWorkspaceShape {
readonly supportedArchitectures: {
readonly os: ReadonlyArray<string>;
readonly cpu: ReadonlyArray<string>;
readonly libc?: ReadonlyArray<string>;
};
readonly allowBuilds?: Record<string, boolean>;
readonly patchedDependencies?: Record<string, string>;
readonly overrides?: Record<string, string>;
}
export function resolveFffNativeDependencies(
platform: StagePlatform,
arch: StageArch,
version: string,
): Record<string, string> {
const architectures = arch === "universal" ? (["arm64", "x64"] as const) : [arch];
if (platform === "mac") {
return Object.fromEntries(
architectures.map((architecture) => [`@ff-labs/fff-bin-darwin-${architecture}`, version]),
);
}
if (platform === "win") {
return Object.fromEntries(
architectures.map((architecture) => [`@ff-labs/fff-bin-win32-${architecture}`, version]),
);
}
return Object.fromEntries(
architectures.flatMap((architecture) =>
["gnu", "musl"].map((libc) => [`@ff-labs/fff-bin-linux-${architecture}-${libc}`, version]),
),
);
}
export function createStageWorkspaceConfig(input: {
readonly platform: StagePlatform;
readonly arch: StageArch;
readonly allowBuilds?: Record<string, boolean>;
readonly patchedDependencies?: Record<string, string>;
readonly overrides?: Record<string, string>;
}): StageWorkspaceShape {
const { platform, arch, allowBuilds, patchedDependencies, overrides } = input;
const hostOs = platform === "mac" ? "darwin" : platform === "win" ? "win32" : "linux";
const hostCpu = arch === "universal" ? ["arm64", "x64"] : [arch];
const supportedArchitectures =
platform === "linux"
? {
os: [hostOs],
cpu: hostCpu,
libc: ["glibc"],
}
: {
os: [hostOs],
cpu: hostCpu,
};
return {
supportedArchitectures,
...(allowBuilds && Object.keys(allowBuilds).length > 0 ? { allowBuilds } : {}),
...(patchedDependencies && Object.keys(patchedDependencies).length > 0
? { patchedDependencies }
: {}),
...(overrides && Object.keys(overrides).length > 0 ? { overrides } : {}),
};
}
export function createStagePatchedDependencies(
patchedDependencies: Record<string, string>,
dependencies: Record<string, unknown>,
): Record<string, string> {
return Object.fromEntries(
Object.entries(patchedDependencies).filter(([patchKey]) =>
Object.hasOwn(dependencies, getPatchedDependencyPackageName(patchKey)),
),
);
}
function getPatchedDependencyPackageName(patchKey: string): string {
const versionSeparator = patchKey.lastIndexOf("@");
return versionSeparator > 0 ? patchKey.slice(0, versionSeparator) : patchKey;
}