From f135a07ebeb51648d9efd87ccdcf39e2148bc962 Mon Sep 17 00:00:00 2001 From: Pine Date: Mon, 7 Sep 2026 23:29:53 +0800 Subject: [PATCH] =?UTF-8?q?build:=20macOS=20=E6=89=93=E5=8C=85=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E7=A1=AE=E4=BF=9D=E7=94=9F=E6=88=90=20DMG=20=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:build_macos_pyinstaller.sh Step 3 显式指定 --bundles app,覆盖了 tauri.conf.json 里的 dmg target,只生成 .app 然后手动打 ZIP,完全没生成 DMG。 修复: 1. --bundles app → --bundles app,dmg(同时构建 .app 和 .dmg) 2. Step 4 增加 DMG 产物收集:从 bundle/dmg/*.dmg 复制到 dist/, 命名 YunOPC-Hub-{VERSION}-macOS.dmg,输出大小和路径 3. 构建完成摘要增加 DMG 路径 4. package.json 增加快捷脚本:tauri:dev / tauri:build / tauri:build:mac / tauri:build:mac:debug 5. tauri.conf.json bundle.macOS.dmg 增加专业配置: windowSize [640,440] + applicationFolder=true(DMG 内显示 /Applications 快捷方式,支持拖拽安装) macOS DMG 打包依赖系统自带 hdiutil,无需额外安装。 --- console/package.json | 11 ++++++++--- console/src-tauri/tauri.conf.json | 9 ++++++++- scripts/pack-tauri/build_macos_pyinstaller.sh | 19 ++++++++++++++++++- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/console/package.json b/console/package.json index 5dcb444..767cc98 100644 --- a/console/package.json +++ b/console/package.json @@ -17,7 +17,11 @@ "preview:test": "vite preview --mode test", "test": "vitest", "test:run": "node --max-old-space-size=4096 ./node_modules/vitest/vitest.mjs run", - "test:coverage": "node --max-old-space-size=4096 ./node_modules/vitest/vitest.mjs run --coverage" + "test:coverage": "node --max-old-space-size=4096 ./node_modules/vitest/vitest.mjs run --coverage", + "tauri:dev": "tauri dev", + "tauri:build": "tauri build", + "tauri:build:mac": "tauri build --bundles app,dmg", + "tauri:build:mac:debug": "tauri build --debug --bundles app,dmg" }, "dependencies": { "3d-force-graph": "1.80.0", @@ -97,6 +101,7 @@ "repository": "https://github.com/agentscope-ai/agentscope-runtime.git", "packageManager": "yarn@4.18.0", "resolutions": { - "@types/react": "18.3.31" + "@types/react": "18.3.31", + "@agentscope-ai/design@npm:1.0.32": "patch:@agentscope-ai/design@npm%3A1.0.32#./.yarn/patches/@agentscope-ai-design-1.0.32.patch" } -} +} \ No newline at end of file diff --git a/console/src-tauri/tauri.conf.json b/console/src-tauri/tauri.conf.json index 1fc4319..0d6c313 100644 --- a/console/src-tauri/tauri.conf.json +++ b/console/src-tauri/tauri.conf.json @@ -65,7 +65,14 @@ } }, "macOS": { - "minimumSystemVersion": "14.0" + "minimumSystemVersion": "14.0", + "dmg": { + "windowSize": [ + 640, + 440 + ], + "applicationFolder": true + } }, "createUpdaterArtifacts": true }, diff --git a/scripts/pack-tauri/build_macos_pyinstaller.sh b/scripts/pack-tauri/build_macos_pyinstaller.sh index 371eac8..8add491 100755 --- a/scripts/pack-tauri/build_macos_pyinstaller.sh +++ b/scripts/pack-tauri/build_macos_pyinstaller.sh @@ -128,7 +128,7 @@ cd console echo "Building for macOS..." npm exec -- tauri build \ --config src-tauri/tauri.version.conf.json \ - --bundles app + --bundles app,dmg cd .. echo "Tauri app built" echo "" @@ -190,6 +190,22 @@ else fi echo "" +# Collect DMG disk image (Tauri dmg bundle target) +DMG_GLOB="${BUNDLE_DIR}/dmg"/*.dmg +DMG_FILES=(${DMG_GLOB}) +if [ ${#DMG_FILES[@]} -gt 0 ] && [ -f "${DMG_FILES[0]}" ]; then + DMG_SRC="${DMG_FILES[0]}" + DMG_NAME="YunOPC-Hub-${VERSION}-macOS.dmg" + DMG_DEST="${DIST_ROOT}/${DMG_NAME}" + cp -f "${DMG_SRC}" "${DMG_DEST}" + DMG_SIZE=$(du -sh "${DMG_DEST}" | cut -f1) + echo "Created ${DMG_DEST} (${DMG_SIZE})" +else + echo "WARNING: No DMG file found at ${BUNDLE_DIR}/dmg/*.dmg" + echo " Tauri dmg bundle may have been skipped. Check that hdiutil is available." +fi +echo "" + UPDATER_NAME="${DIST_ROOT}/YunOPC-Hub-${VERSION}-macOS.app.tar.gz" case "$(uname -m)" in arm64 | aarch64) UPDATER_TARGET="darwin-aarch64" ;; @@ -215,6 +231,7 @@ echo "=========================================" echo "App: ${APP_PATH}" echo "Distribution: ${DIST_DIR}" echo "Archive: ${ZIP_NAME}" +echo "DMG: ${DMG_DEST:-not generated}" echo "Updater: ${UPDATER_NAME}" echo "" echo "Test: open \"${STAGED_APP_PATH}\""