|
|
@@ -1087,9 +1087,15 @@ where
|
|
|
};
|
|
|
|
|
|
// 按界面顺序安装:Node.js -> pnpm -> Git -> Claude Code -> VS Code -> Claude Code Ext
|
|
|
+ // 只有所有已执行的安装都成功后才继续下一个
|
|
|
+
|
|
|
+ // 辅助函数:检查所有已执行的安装是否都成功(如果还没有执行任何安装,返回 true)
|
|
|
+ let all_success_so_far = |results: &[(&str, Result<InstallResult, String>)]| -> bool {
|
|
|
+ results.is_empty() || results.iter().all(|(_, r)| r.as_ref().map(|r| r.success).unwrap_or(false))
|
|
|
+ };
|
|
|
|
|
|
// 1. Node.js
|
|
|
- if options.install_nodejs.unwrap_or(false) {
|
|
|
+ if options.install_nodejs.unwrap_or(false) && all_success_so_far(&results) {
|
|
|
let step = current_step;
|
|
|
let total = total_steps;
|
|
|
let sub_emit = |msg: &str, prog: f64, key: Option<&str>, skip: bool, params: Option<serde_json::Value>| {
|
|
|
@@ -1101,8 +1107,8 @@ where
|
|
|
current_step += 1;
|
|
|
}
|
|
|
|
|
|
- // 2. pnpm
|
|
|
- if options.install_pnpm.unwrap_or(false) {
|
|
|
+ // 2. pnpm (需要前面所有安装都成功)
|
|
|
+ if options.install_pnpm.unwrap_or(false) && all_success_so_far(&results) {
|
|
|
let step = current_step;
|
|
|
let total = total_steps;
|
|
|
let sub_emit = |msg: &str, prog: f64, key: Option<&str>, skip: bool, params: Option<serde_json::Value>| {
|
|
|
@@ -1114,8 +1120,8 @@ where
|
|
|
current_step += 1;
|
|
|
}
|
|
|
|
|
|
- // 3. Git
|
|
|
- if options.install_git.unwrap_or(false) {
|
|
|
+ // 3. Git (需要前面所有安装都成功)
|
|
|
+ if options.install_git.unwrap_or(false) && all_success_so_far(&results) {
|
|
|
let step = current_step;
|
|
|
let total = total_steps;
|
|
|
let sub_emit = |msg: &str, prog: f64, key: Option<&str>, skip: bool, params: Option<serde_json::Value>| {
|
|
|
@@ -1127,8 +1133,8 @@ where
|
|
|
current_step += 1;
|
|
|
}
|
|
|
|
|
|
- // 4. Claude Code
|
|
|
- if options.install_claude_code.unwrap_or(false) {
|
|
|
+ // 4. Claude Code (需要前面所有安装都成功)
|
|
|
+ if options.install_claude_code.unwrap_or(false) && all_success_so_far(&results) {
|
|
|
let step = current_step;
|
|
|
let total = total_steps;
|
|
|
let sub_emit = |msg: &str, prog: f64, key: Option<&str>, skip: bool, params: Option<serde_json::Value>| {
|
|
|
@@ -1140,8 +1146,8 @@ where
|
|
|
current_step += 1;
|
|
|
}
|
|
|
|
|
|
- // 5. VS Code
|
|
|
- if options.install_vscode.unwrap_or(false) {
|
|
|
+ // 5. VS Code (需要前面所有安装都成功)
|
|
|
+ if options.install_vscode.unwrap_or(false) && all_success_so_far(&results) {
|
|
|
let step = current_step;
|
|
|
let total = total_steps;
|
|
|
let sub_emit = |msg: &str, prog: f64, key: Option<&str>, skip: bool, params: Option<serde_json::Value>| {
|
|
|
@@ -1153,8 +1159,8 @@ where
|
|
|
current_step += 1;
|
|
|
}
|
|
|
|
|
|
- // 6. Claude Code for VS Code 扩展
|
|
|
- if options.install_claude_code_ext.unwrap_or(false) {
|
|
|
+ // 6. Claude Code for VS Code 扩展 (需要前面所有安装都成功)
|
|
|
+ if options.install_claude_code_ext.unwrap_or(false) && all_success_so_far(&results) {
|
|
|
let step = current_step;
|
|
|
let total = total_steps;
|
|
|
let sub_emit = |msg: &str, prog: f64, key: Option<&str>, skip: bool, params: Option<serde_json::Value>| {
|