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,
|
result?: CommandRunResult,
|
||||||
) => {
|
) => {
|
||||||
const percent = Math.round((current / totalSteps) * 100);
|
const percent = Math.round((current / totalSteps) * 100);
|
||||||
onProgress?.({
|
const step: InstallStep = {
|
||||||
name,
|
name,
|
||||||
ok: status !== "error",
|
ok: status !== "error",
|
||||||
message,
|
message,
|
||||||
status,
|
status,
|
||||||
progress: { current, total: totalSteps, percent },
|
progress: { current, total: totalSteps, percent },
|
||||||
result,
|
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");
|
const wingetPath = await resolveCommandPath("winget");
|
||||||
if (!wingetPath.ok) {
|
if (!wingetPath.ok) {
|
||||||
const errorStep = {
|
emitProgress("winget 확인", 1, "error", wingetPath.error, {
|
||||||
name: "winget 확인",
|
|
||||||
ok: false,
|
ok: false,
|
||||||
message: wingetPath.error,
|
command: "winget",
|
||||||
result: {
|
args: ["--version"],
|
||||||
ok: false,
|
error: wingetPath.error,
|
||||||
command: "winget",
|
});
|
||||||
args: ["--version"],
|
|
||||||
error: wingetPath.error,
|
|
||||||
},
|
|
||||||
status: "error" as const,
|
|
||||||
progress: { current: 1, total: totalSteps, percent: 33 },
|
|
||||||
};
|
|
||||||
steps.push(errorStep);
|
|
||||||
onProgress?.(errorStep);
|
|
||||||
return {
|
return {
|
||||||
ok: false,
|
ok: false,
|
||||||
error: "winget이 설치되어 있지 않습니다.",
|
error: "winget이 설치되어 있지 않습니다.",
|
||||||
steps,
|
steps,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
emitProgress("winget 확인", 1, "done", undefined, { ok: true, command: "winget", args: ["--version"] });
|
||||||
|
|
||||||
// Winget check success
|
// 2. Git Install
|
||||||
/*
|
|
||||||
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);
|
|
||||||
|
|
||||||
emitProgress("Git 설치", 2, "running");
|
emitProgress("Git 설치", 2, "running");
|
||||||
const gitInstall = await runCommand(
|
const gitInstall = await runCommand(
|
||||||
"winget",
|
"winget",
|
||||||
|
|
@ -1164,21 +1147,16 @@ const installGitTools = async (
|
||||||
"--accept-source-agreements",
|
"--accept-source-agreements",
|
||||||
"--accept-package-agreements",
|
"--accept-package-agreements",
|
||||||
"--silent",
|
"--silent",
|
||||||
"--disable-interactivity" // Ensure no blocking prompts
|
"--disable-interactivity"
|
||||||
],
|
],
|
||||||
INSTALL_TIMEOUT_MS,
|
INSTALL_TIMEOUT_MS,
|
||||||
);
|
);
|
||||||
const gitInstallStep: InstallStep = {
|
emitProgress("Git 설치", 2, gitInstall.ok ? "done" : "error", gitInstall.ok ? undefined : (gitInstall.error ?? gitInstall.output), gitInstall);
|
||||||
name: "Git 설치",
|
if (!gitInstall.ok) {
|
||||||
ok: gitInstall.ok,
|
return { ok: false, error: "Git 설치에 실패했습니다.", steps };
|
||||||
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);
|
|
||||||
|
|
||||||
|
// 3. Git LFS Install
|
||||||
emitProgress("Git LFS 설치", 3, "running");
|
emitProgress("Git LFS 설치", 3, "running");
|
||||||
const lfsInstall = await runCommand(
|
const lfsInstall = await runCommand(
|
||||||
"winget",
|
"winget",
|
||||||
|
|
@ -1196,16 +1174,10 @@ const installGitTools = async (
|
||||||
],
|
],
|
||||||
INSTALL_TIMEOUT_MS,
|
INSTALL_TIMEOUT_MS,
|
||||||
);
|
);
|
||||||
const lfsInstallStep: InstallStep = {
|
emitProgress("Git LFS 설치", 3, lfsInstall.ok ? "done" : "error", lfsInstall.ok ? undefined : (lfsInstall.error ?? lfsInstall.output), lfsInstall);
|
||||||
name: "Git LFS 설치",
|
if (!lfsInstall.ok) {
|
||||||
ok: lfsInstall.ok,
|
return { ok: false, error: "Git LFS 설치에 실패했습니다.", steps };
|
||||||
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);
|
|
||||||
|
|
||||||
const ok = steps.every((step) => step.ok);
|
const ok = steps.every((step) => step.ok);
|
||||||
await refreshWindowsPath();
|
await refreshWindowsPath();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue