黄中银 2 недель назад
Родитель
Сommit
2e85f85f1c
8 измененных файлов с 54 добавлено и 22 удалено
  1. 1 1
      package.json
  2. 27 7
      scripts/build.js
  3. 19 9
      scripts/release.cjs
  4. 3 1
      shared/types.ts
  5. 1 1
      src-tauri/Cargo.toml
  6. 1 1
      src-tauri/gen/schemas/capabilities.json
  7. 1 1
      src-tauri/tauri.conf.json
  8. 1 1
      src/api/tauri.ts

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "claude-ai-installer",
   "name": "claude-ai-installer",
-  "version": "0.0.4",
+  "version": "0.0.5",
   "description": "Claude AI安装器 - Claude AI Installer",
   "description": "Claude AI安装器 - Claude AI Installer",
   "type": "module",
   "type": "module",
   "scripts": {
   "scripts": {

+ 27 - 7
scripts/build.js

@@ -160,6 +160,25 @@ function renameArtifacts(options) {
   const bundleDir = path.join(targetDir, 'bundle');
   const bundleDir = path.join(targetDir, 'bundle');
   const version = getVersion();
   const version = getVersion();
 
 
+  // 创建 portable 版本(复制可执行文件到 bundle 目录)
+  const exeName = 'claude-ai-installer.exe';
+  const exePath = path.join(targetDir, exeName);
+  if (fs.existsSync(exePath)) {
+    // 确保 bundle 目录存在
+    if (!fs.existsSync(bundleDir)) {
+      fs.mkdirSync(bundleDir, { recursive: true });
+    }
+    // 新文件名格式: Claude-AI-Installer-{version}-win-x64-portable.exe
+    const portableName = `Claude-AI-Installer-${version}-win-x64-portable.exe`;
+    const portablePath = path.join(bundleDir, portableName);
+    // 如果目标文件已存在,先删除
+    if (fs.existsSync(portablePath)) {
+      fs.unlinkSync(portablePath);
+    }
+    fs.copyFileSync(exePath, portablePath);
+    log.success(`创建便携版: ${portableName}`);
+  }
+
   // 重命名 NSIS 安装程序
   // 重命名 NSIS 安装程序
   const nsisDir = path.join(bundleDir, 'nsis');
   const nsisDir = path.join(bundleDir, 'nsis');
   if (fs.existsSync(nsisDir)) {
   if (fs.existsSync(nsisDir)) {
@@ -211,14 +230,15 @@ function showResults(options) {
 
 
   console.log('');
   console.log('');
 
 
-  // 显示可执行文件
-  const exeName = 'claude-ai-installer.exe';
-  const exePath = path.join(targetDir, exeName);
-  if (fs.existsSync(exePath)) {
-    const stats = fs.statSync(exePath);
+  // 显示便携版
+  const portableFiles = fs.existsSync(bundleDir)
+    ? fs.readdirSync(bundleDir).filter(f => f.endsWith('-portable.exe'))
+    : [];
+  for (const file of portableFiles) {
+    const filePath = path.join(bundleDir, file);
+    const stats = fs.statSync(filePath);
     const sizeMB = (stats.size / (1024 * 1024)).toFixed(2);
     const sizeMB = (stats.size / (1024 * 1024)).toFixed(2);
-    console.log(`  ${colors.green}•${colors.reset} ${exeName} (${sizeMB} MB)`);
-    log.info(`  路径: ${exePath}`);
+    console.log(`  ${colors.green}•${colors.reset} ${file} (${sizeMB} MB) [便携版]`);
   }
   }
 
 
   // 显示 NSIS 安装程序
   // 显示 NSIS 安装程序

+ 19 - 9
scripts/release.cjs

@@ -232,8 +232,20 @@ function copyArtifactsToRelease() {
   const tauriDir = path.join(projectRoot, 'src-tauri');
   const tauriDir = path.join(projectRoot, 'src-tauri');
   const bundleDir = path.join(tauriDir, 'target', 'release', 'bundle');
   const bundleDir = path.join(tauriDir, 'target', 'release', 'bundle');
 
 
-  // 确保 release 目录存在
-  if (!fs.existsSync(releaseDir)) {
+  // 清空 release 目录(保留目录本身)
+  if (fs.existsSync(releaseDir)) {
+    const files = fs.readdirSync(releaseDir);
+    for (const file of files) {
+      const filePath = path.join(releaseDir, file);
+      const stat = fs.statSync(filePath);
+      if (stat.isFile()) {
+        fs.unlinkSync(filePath);
+      } else if (stat.isDirectory()) {
+        fs.rmSync(filePath, { recursive: true });
+      }
+    }
+    log.success('已清空 release 目录');
+  } else {
     fs.mkdirSync(releaseDir, { recursive: true });
     fs.mkdirSync(releaseDir, { recursive: true });
   }
   }
 
 
@@ -272,17 +284,15 @@ function copyArtifactsToRelease() {
     }
     }
   }
   }
 
 
-  // 复制 Portable exe(独立可执行文件)
-  const tauriReleaseDir = path.join(tauriDir, 'target', 'release');
+  // 复制 Portable exe(从 bundle 目录)
   const pkg = readPackageJson();
   const pkg = readPackageJson();
   const version = pkg.version;
   const version = pkg.version;
-  const portableExeName = 'Claude AI Installer.exe';
-  const portableExePath = path.join(tauriReleaseDir, portableExeName);
+  const portableExeName = `Claude-AI-Installer-${version}-win-x64-portable.exe`;
+  const portableExePath = path.join(bundleDir, portableExeName);
   if (fs.existsSync(portableExePath)) {
   if (fs.existsSync(portableExePath)) {
-    const destName = `Claude-AI-Installer-${version}-win-x64-portable.exe`;
-    const dest = path.join(releaseDir, destName);
+    const dest = path.join(releaseDir, portableExeName);
     fs.copyFileSync(portableExePath, dest);
     fs.copyFileSync(portableExePath, dest);
-    log.success(`复制: ${destName}`);
+    log.success(`复制: ${portableExeName}`);
   }
   }
 }
 }
 
 

+ 3 - 1
shared/types.ts

@@ -192,7 +192,9 @@ export interface ElectronAPI {
   windowMaximize: () => Promise<boolean>
   windowMaximize: () => Promise<boolean>
   windowClose: () => Promise<void>
   windowClose: () => Promise<void>
   windowIsMaximized: () => Promise<boolean>
   windowIsMaximized: () => Promise<boolean>
-  saveWindowState: () => Promise<void>
+  saveWindowState: () => void
+  saveWindowStateImmediate: () => Promise<void>
+  startWindowStateListener: () => void
   restoreWindowState: () => Promise<void>
   restoreWindowState: () => Promise<void>
 
 
   // Claude Code
   // Claude Code

+ 1 - 1
src-tauri/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 [package]
 name = "claude-ai-installer"
 name = "claude-ai-installer"
-version = "0.0.4"
+version = "0.0.5"
 description = "Claude AI安装器 - Claude AI Installer"
 description = "Claude AI安装器 - Claude AI Installer"
 authors = ["Claude AI"]
 authors = ["Claude AI"]
 edition = "2021"
 edition = "2021"

+ 1 - 1
src-tauri/gen/schemas/capabilities.json

@@ -1 +1 @@
-{"default":{"identifier":"default","description":"Default capabilities for the application","local":true,"windows":["main"],"permissions":["core:default","core:window:default","core:window:allow-close","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-start-dragging","core:window:allow-set-size","core:window:allow-set-position","core:window:allow-set-title","core:window:allow-show","core:window:allow-hide","dialog:default","dialog:allow-open","dialog:allow-save","dialog:allow-message","dialog:allow-ask","dialog:allow-confirm","fs:default","fs:allow-read-text-file","fs:allow-write-text-file","fs:allow-exists","fs:allow-mkdir","fs:allow-remove","fs:allow-rename","fs:allow-copy-file","http:default","process:default","process:allow-exit","process:allow-restart","log:default","store:default","os:default","shell:allow-open",{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"powershell","name":"powershell"},{"args":true,"cmd":"cmd","name":"cmd"},{"args":true,"cmd":"node","name":"node"},{"args":true,"cmd":"npm","name":"npm"},{"args":true,"cmd":"pnpm","name":"pnpm"},{"args":true,"cmd":"git","name":"git"},{"args":true,"cmd":"code","name":"code"},{"args":true,"cmd":"claude","name":"claude"},{"args":true,"cmd":"msiexec","name":"msiexec"},{"args":true,"cmd":"brew","name":"brew"},{"args":true,"cmd":"apt","name":"apt"},{"args":true,"cmd":"apt-get","name":"apt-get"},{"args":true,"cmd":"where","name":"where"},{"args":true,"cmd":"which","name":"which"}]}]}}
+{"default":{"identifier":"default","description":"Default capabilities for the application","local":true,"windows":["main"],"permissions":["core:default","core:window:default","core:window:allow-close","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-start-dragging","core:window:allow-set-size","core:window:allow-set-position","core:window:allow-set-title","core:window:allow-show","core:window:allow-hide","core:window:allow-inner-size","core:window:allow-outer-position","core:window:allow-is-maximized","dialog:default","dialog:allow-open","dialog:allow-save","dialog:allow-message","dialog:allow-ask","dialog:allow-confirm","fs:default","fs:allow-read-text-file","fs:allow-write-text-file","fs:allow-exists","fs:allow-mkdir","fs:allow-remove","fs:allow-rename","fs:allow-copy-file","http:default","process:default","process:allow-exit","process:allow-restart","log:default","store:default","os:default","shell:allow-open",{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"powershell","name":"powershell"},{"args":true,"cmd":"cmd","name":"cmd"},{"args":true,"cmd":"node","name":"node"},{"args":true,"cmd":"npm","name":"npm"},{"args":true,"cmd":"pnpm","name":"pnpm"},{"args":true,"cmd":"git","name":"git"},{"args":true,"cmd":"code","name":"code"},{"args":true,"cmd":"claude","name":"claude"},{"args":true,"cmd":"msiexec","name":"msiexec"},{"args":true,"cmd":"brew","name":"brew"},{"args":true,"cmd":"apt","name":"apt"},{"args":true,"cmd":"apt-get","name":"apt-get"},{"args":true,"cmd":"where","name":"where"},{"args":true,"cmd":"which","name":"which"}]}]}}

+ 1 - 1
src-tauri/tauri.conf.json

@@ -1,7 +1,7 @@
 {
 {
   "$schema": "https://schema.tauri.app/config/2",
   "$schema": "https://schema.tauri.app/config/2",
   "productName": "Claude AI Installer",
   "productName": "Claude AI Installer",
-  "version": "0.0.4",
+  "version": "0.0.5",
   "identifier": "com.claude.ai.installer",
   "identifier": "com.claude.ai.installer",
   "build": {
   "build": {
     "beforeDevCommand": "npm run dev:frontend",
     "beforeDevCommand": "npm run dev:frontend",

+ 1 - 1
src/api/tauri.ts

@@ -1,7 +1,7 @@
 // Tauri API 封装 - 替代原来的 Electron API
 // Tauri API 封装 - 替代原来的 Electron API
 import { invoke } from '@tauri-apps/api/core'
 import { invoke } from '@tauri-apps/api/core'
 import { listen, type UnlistenFn } from '@tauri-apps/api/event'
 import { listen, type UnlistenFn } from '@tauri-apps/api/event'
-import { getCurrentWindow, type PhysicalPosition, type PhysicalSize } from '@tauri-apps/api/window'
+import { getCurrentWindow, PhysicalPosition, PhysicalSize } from '@tauri-apps/api/window'
 import { Store } from '@tauri-apps/plugin-store'
 import { Store } from '@tauri-apps/plugin-store'
 
 
 // 窗口状态存储
 // 窗口状态存储