Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
aae434f
feat(desktop): 按工作流重整设置与桌面界面
yyjeqhc Sep 30, 2026
9ca27d9
feat(desktop): 精简首页并完善连接故障处理
yyjeqhc Sep 30, 2026
45e1a23
fix(desktop): 恢复自动连接并保留持久 Tunnel 状态
yyjeqhc Sep 30, 2026
873b2c4
feat(desktop): 添加独立繁体中文界面支持
yyjeqhc Sep 30, 2026
2ecc84a
feat(desktop): 简化扩展路径配置与项目预览
yyjeqhc Sep 30, 2026
39aa794
feat(desktop): 解释项目执行设备与桌面会话状态
yyjeqhc Sep 30, 2026
35ca247
feat(desktop): 重排活动列表并明确执行与检查状态
yyjeqhc Sep 30, 2026
9305eaa
feat(desktop): 澄清隧道与扩展状态并补齐桌面访问说明
yyjeqhc Sep 30, 2026
4217c3a
feat(desktop): 说明扩展用途并独立原生 Plugin 分类
yyjeqhc Sep 30, 2026
e00d309
feat(desktop): 突出运行控制台并按工作流整理服务设置
yyjeqhc Sep 30, 2026
db01bc5
fix(desktop): 按实际接口展示 Plugin 加载状态与恢复操作
yyjeqhc Sep 30, 2026
be5e1fd
Merge branch 'main' into feat/desktop-workflow-layout
yyjeqhc Sep 30, 2026
1b9ea7f
fix(desktop): 区分 Runtime 文件存在性与启动验证状态
yyjeqhc Sep 30, 2026
f0bd6fd
fix(desktop): 为初始化失败保留 Runtime 诊断上下文
yyjeqhc Sep 30, 2026
d14a57e
test(desktop): 按新的服务设置布局修复 CI 回归测试
yyjeqhc Sep 30, 2026
5e595ac
fix(desktop): rebuild UI before every production package
yyjeqhc Sep 30, 2026
c5231df
fix(desktop): preflight providers and surface terminal startup failures
yyjeqhc Sep 30, 2026
044debf
fix(installer): transact legacy Windows v0.4.3 package upgrades
yyjeqhc Sep 30, 2026
7297aca
Merge branch 'main' into feat/desktop-workflow-layout
yyjeqhc Sep 30, 2026
f57978f
fix(desktop): align local MCP host defaults
yyjeqhc Sep 30, 2026
d53783f
fix(installer): support v0.4.3 Windows ARM64 upgrades
yyjeqhc Sep 30, 2026
30c9d0c
fix(desktop): enable owned service tracing and clarify its status
yyjeqhc Sep 30, 2026
b490228
fix trace ui
yyjeqhc Sep 30, 2026
91355c9
fix trace ui
yyjeqhc Sep 30, 2026
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
Prev Previous commit
Next Next commit
fix(desktop): rebuild UI before every production package
  • Loading branch information
yyjeqhc committed Sep 30, 2026
commit 5e595ac34c716678d20e94b845f1fa7d5ea4425c
32 changes: 32 additions & 0 deletions apps/desktop/src-tauri/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
fn main() {
// Direct Cargo production builds also embed dist. The Tauri CLI hook alone
// does not run for that entry point; never compile new native code against
// a previously built UI tree.
if !tauri_build::is_dev() {
let desktop = std::path::PathBuf::from(
std::env::var_os("CARGO_MANIFEST_DIR").expect("Cargo manifest directory"),
)
.parent()
.expect("Desktop directory")
.to_owned();
let status = std::process::Command::new(if cfg!(windows) { "npm.cmd" } else { "npm" })
.args(["run", "build"])
.current_dir(desktop)
.stdin(std::process::Stdio::null())
.status()
.expect("Desktop frontend build could not start");
assert!(
status.success(),
"Desktop frontend build failed; refusing to embed stale dist"
);
}
for input in [
"../src",
"../index.html",
"../package.json",
"../package-lock.json",
"../vite.config.ts",
"../tsconfig.json",
"../../../frontend/src",
] {
println!("cargo:rerun-if-changed={input}");
}
tauri_build::build()
}
6 changes: 4 additions & 2 deletions apps/desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"build": {
"beforeDevCommand": "npm run dev",
"devUrl": "http://127.0.0.1:1420",
"beforeBuildCommand": "npm run build",
"beforeBuildCommand": {
"script": "npm run build",
"cwd": ".."
},
"frontendDist": "../dist"
},
"app": {
Expand Down Expand Up @@ -44,4 +47,3 @@
}
}
}

61 changes: 61 additions & 0 deletions scripts/tests/test_desktop_frontend_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"""Exercise the production Tauri hook from its native cwd with an old dist tree."""
import json
import os
import shutil
import subprocess
import tempfile
import unittest
from pathlib import Path

ROOT = Path(__file__).resolve().parents[2]


class DesktopFrontendBuildTests(unittest.TestCase):
@unittest.skipUnless(shutil.which("npm") and shutil.which("rustc"), "npm and rustc are required")
def test_direct_production_cargo_build_rebuilds_dist_and_failed_build_is_fatal(self):
with tempfile.TemporaryDirectory() as temporary:
desktop = Path(temporary)
native = desktop / "src-tauri"
native.mkdir()
(desktop / "dist").mkdir()
(desktop / "dist/index.html").write_text("old UI")
(desktop / "package.json").write_text(json.dumps({"scripts": {"build": "node build.cjs"}}))
(desktop / "build.cjs").write_text("require('fs').writeFileSync('dist/index.html', 'new UI')")
# Compile the real build entry point, stubbing only Tauri helpers.
source = native / "build_fixture.rs"
source.write_text('mod tauri_build { pub fn is_dev() -> bool { false } pub fn build() {} }\n'
+ (ROOT / "apps/desktop/src-tauri/build.rs").read_text())
program = native / ("build_fixture.exe" if os.name == "nt" else "build_fixture")
compiled = subprocess.run(["rustc", str(source), "-o", str(program)], stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=30)
self.assertEqual(compiled.returncode, 0)
env = {**os.environ, "CARGO_MANIFEST_DIR": str(native)}
result = subprocess.run([str(program)], cwd=desktop, env=env, stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=30)
self.assertEqual(result.returncode, 0)
self.assertEqual((desktop / "dist/index.html").read_text(), "new UI")
(desktop / "build.cjs").write_text("process.exit(1)")
failed = subprocess.run([str(program)], cwd=desktop, env=env, stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=30)
self.assertNotEqual(failed.returncode, 0, "A failed UI build must stop native packaging")

@unittest.skipUnless(shutil.which("npm"), "npm is required to exercise the build hook")
def test_native_build_hook_replaces_stale_dist_in_desktop_not_repo_frontend(self):
hook = json.loads((ROOT / "apps/desktop/src-tauri/tauri.conf.json").read_text())["build"]["beforeBuildCommand"]
with tempfile.TemporaryDirectory() as temporary:
root = Path(temporary)
desktop = root / "apps/desktop"
native = desktop / "src-tauri"
native.mkdir(parents=True)
(desktop / "dist").mkdir()
(desktop / "dist/index.html").write_text("stale Desktop UI")
(desktop / "package.json").write_text(json.dumps({"scripts": {"build": "node build.cjs"}}))
(desktop / "build.cjs").write_text("require('fs').writeFileSync('dist/index.html', 'current Desktop UI')")
# A decoy frontend models Tauri's workspace frontend discovery.
frontend = root / "frontend"
frontend.mkdir()
(frontend / "package.json").write_text(json.dumps({"scripts": {"build": "node -e \"process.exit(42)\""}}))
result = subprocess.run(hook["script"], cwd=native / hook["cwd"], shell=True,
stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=30)
self.assertEqual(result.returncode, 0, "Desktop build hook did not complete")
self.assertEqual((desktop / "dist/index.html").read_text(), "current Desktop UI")