feat: 함수를 리팩토링하여 관리를 통합하고 파일을 추가했습니다.
This commit is contained in:
parent
ce6d43f597
commit
ea4eefb525
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
description: UI Component 제작 및 활용
|
||||
---
|
||||
|
||||
- UI 요소 작업시 재활용 가능하게 작업할 것
|
||||
- 기존 재활용 가능한 요소가 있는지 확인 후
|
||||
-> 있음 : 재활용
|
||||
-> 없음 : 재활용 가능하게 작업 사항 추가
|
||||
|
|
@ -1094,63 +1094,46 @@ const installGitTools = async (
|
|||
result?: CommandRunResult,
|
||||
) => {
|
||||
const percent = Math.round((current / totalSteps) * 100);
|
||||
onProgress?.({
|
||||
const step: InstallStep = {
|
||||
name,
|
||||
ok: status !== "error",
|
||||
message,
|
||||
status,
|
||||
progress: { current, total: totalSteps, percent },
|
||||
result,
|
||||
});
|
||||
};
|
||||
|
||||
// Update or add to steps array
|
||||
const existingIdx = steps.findIndex(s => s.name === name);
|
||||
if (existingIdx >= 0) {
|
||||
steps[existingIdx] = step;
|
||||
} else {
|
||||
steps.push(step);
|
||||
}
|
||||
|
||||
onProgress?.(step);
|
||||
return step;
|
||||
};
|
||||
|
||||
// 1. Winget Check
|
||||
emitProgress("winget 확인", 1, "running");
|
||||
const wingetPath = await resolveCommandPath("winget");
|
||||
if (!wingetPath.ok) {
|
||||
const errorStep = {
|
||||
name: "winget 확인",
|
||||
emitProgress("winget 확인", 1, "error", wingetPath.error, {
|
||||
ok: false,
|
||||
message: wingetPath.error,
|
||||
result: {
|
||||
ok: false,
|
||||
command: "winget",
|
||||
args: ["--version"],
|
||||
error: wingetPath.error,
|
||||
},
|
||||
status: "error" as const,
|
||||
progress: { current: 1, total: totalSteps, percent: 33 },
|
||||
};
|
||||
steps.push(errorStep);
|
||||
onProgress?.(errorStep);
|
||||
command: "winget",
|
||||
args: ["--version"],
|
||||
error: wingetPath.error,
|
||||
});
|
||||
return {
|
||||
ok: false,
|
||||
error: "winget이 설치되어 있지 않습니다.",
|
||||
steps,
|
||||
};
|
||||
}
|
||||
emitProgress("winget 확인", 1, "done", undefined, { ok: true, command: "winget", args: ["--version"] });
|
||||
|
||||
// Winget check success
|
||||
/*
|
||||
const wingetStep = {
|
||||
name: "winget 확인",
|
||||
result: { ok: true, command: "winget", args: ["--version"] }
|
||||
};
|
||||
steps.push(wingetStep);
|
||||
onProgress?.(wingetStep);
|
||||
*/
|
||||
// skipping separate success step for winget to match previous behavior purely?
|
||||
// User asked for "same template", so seeing "Winget Check... OK" is good.
|
||||
// I will add it for clarity.
|
||||
emitProgress("winget 확인", 1, "running");
|
||||
const wingetStep = {
|
||||
name: "winget 확인",
|
||||
ok: true,
|
||||
result: { ok: true, command: "winget", args: ["--version"] },
|
||||
status: "done" as const,
|
||||
progress: { current: 1, total: totalSteps, percent: 33 },
|
||||
};
|
||||
steps.push(wingetStep);
|
||||
onProgress?.(wingetStep);
|
||||
|
||||
// 2. Git Install
|
||||
emitProgress("Git 설치", 2, "running");
|
||||
const gitInstall = await runCommand(
|
||||
"winget",
|
||||
|
|
@ -1164,21 +1147,16 @@ const installGitTools = async (
|
|||
"--accept-source-agreements",
|
||||
"--accept-package-agreements",
|
||||
"--silent",
|
||||
"--disable-interactivity" // Ensure no blocking prompts
|
||||
"--disable-interactivity"
|
||||
],
|
||||
INSTALL_TIMEOUT_MS,
|
||||
);
|
||||
const gitInstallStep: InstallStep = {
|
||||
name: "Git 설치",
|
||||
ok: gitInstall.ok,
|
||||
message: gitInstall.ok ? undefined : (gitInstall.error ?? gitInstall.output),
|
||||
result: gitInstall,
|
||||
status: gitInstall.ok ? "done" : "error",
|
||||
progress: { current: 2, total: totalSteps, percent: 67 },
|
||||
};
|
||||
steps.push(gitInstallStep);
|
||||
onProgress?.(gitInstallStep);
|
||||
emitProgress("Git 설치", 2, gitInstall.ok ? "done" : "error", gitInstall.ok ? undefined : (gitInstall.error ?? gitInstall.output), gitInstall);
|
||||
if (!gitInstall.ok) {
|
||||
return { ok: false, error: "Git 설치에 실패했습니다.", steps };
|
||||
}
|
||||
|
||||
// 3. Git LFS Install
|
||||
emitProgress("Git LFS 설치", 3, "running");
|
||||
const lfsInstall = await runCommand(
|
||||
"winget",
|
||||
|
|
@ -1196,16 +1174,10 @@ const installGitTools = async (
|
|||
],
|
||||
INSTALL_TIMEOUT_MS,
|
||||
);
|
||||
const lfsInstallStep: InstallStep = {
|
||||
name: "Git LFS 설치",
|
||||
ok: lfsInstall.ok,
|
||||
message: lfsInstall.ok ? undefined : (lfsInstall.error ?? lfsInstall.output),
|
||||
result: lfsInstall,
|
||||
status: lfsInstall.ok ? "done" : "error",
|
||||
progress: { current: 3, total: totalSteps, percent: 100 },
|
||||
};
|
||||
steps.push(lfsInstallStep);
|
||||
onProgress?.(lfsInstallStep);
|
||||
emitProgress("Git LFS 설치", 3, lfsInstall.ok ? "done" : "error", lfsInstall.ok ? undefined : (lfsInstall.error ?? lfsInstall.output), lfsInstall);
|
||||
if (!lfsInstall.ok) {
|
||||
return { ok: false, error: "Git LFS 설치에 실패했습니다.", steps };
|
||||
}
|
||||
|
||||
const ok = steps.every((step) => step.ok);
|
||||
await refreshWindowsPath();
|
||||
|
|
|
|||
Loading…
Reference in New Issue