feat: 환경에서 비 Windows 플랫폼의 SPT 설치 경로 확인 및 Git/LFS 설치 시뮬레이션 기능 추가

This commit is contained in:
이정수 2026-02-05 12:34:01 +09:00
parent c78159d442
commit ce6d43f597
1 changed files with 137 additions and 68 deletions

View File

@ -670,7 +670,8 @@ const findSptInstallPath = async (
}; };
const resolveSptInstall = async (): Promise<SptInstallInfo> => { const resolveSptInstall = async (): Promise<SptInstallInfo> => {
if (process.platform !== "win32") { const isDevUi = process.env.VITE_DEV_UI === "1";
if (process.platform !== "win32" && !isDevUi) {
return { return {
ok: false, ok: false,
checkedAt: Date.now(), checkedAt: Date.now(),
@ -1007,7 +1008,10 @@ const runModSync = async (
const installGitTools = async ( const installGitTools = async (
onProgress?: (step: InstallStep) => void, onProgress?: (step: InstallStep) => void,
): Promise<InstallGitToolsResult> => { ): Promise<InstallGitToolsResult> => {
const isDevUi = process.env.VITE_DEV_UI === "1";
if (process.platform !== "win32") { if (process.platform !== "win32") {
if (!isDevUi) {
return { return {
ok: false, ok: false,
error: "Windows에서만 자동 설치가 가능합니다.", error: "Windows에서만 자동 설치가 가능합니다.",
@ -1015,6 +1019,71 @@ const installGitTools = async (
}; };
} }
// Mac/Linux Dev UI Simulation
const steps: InstallStep[] = [];
const totalSteps = 3;
const emitProgress = (
name: string,
current: number,
status: InstallStep["status"],
) => {
const percent = Math.round((current / totalSteps) * 100);
onProgress?.({
name,
ok: status !== "error",
status,
progress: { current, total: totalSteps, percent },
result: { ok: true, command: "simulated", args: [] }
});
};
emitProgress("winget 확인", 1, "running");
await new Promise(r => setTimeout(r, 500));
const wingetStep: InstallStep = {
name: "winget 확인",
ok: true,
status: "done",
progress: { current: 1, total: totalSteps, percent: 33 },
result: { ok: true, command: "simulated", args: [] }
};
steps.push(wingetStep);
onProgress?.(wingetStep);
emitProgress("Git 설치", 2, "running");
await new Promise(r => setTimeout(r, 800));
const gitInstallStep: InstallStep = {
name: "Git 설치",
ok: true,
status: "done",
progress: { current: 2, total: totalSteps, percent: 67 },
result: { ok: true, command: "simulated", args: [] }
};
steps.push(gitInstallStep);
onProgress?.(gitInstallStep);
emitProgress("Git LFS 설치", 3, "running");
await new Promise(r => setTimeout(r, 800));
const lfsInstallStep: InstallStep = {
name: "Git LFS 설치",
ok: true,
status: "done",
progress: { current: 3, total: totalSteps, percent: 100 },
result: { ok: true, command: "simulated", args: [] }
};
steps.push(lfsInstallStep);
onProgress?.(lfsInstallStep);
return {
ok: true,
steps,
check: {
git: { ok: true, command: "git", version: "simulated" },
lfs: { ok: true, command: "git", lfs: "simulated" } as any,
checkedAt: Date.now()
}
};
}
const steps: InstallStep[] = []; const steps: InstallStep[] = [];
const totalSteps = 3; const totalSteps = 3;
const emitProgress = ( const emitProgress = (
@ -1480,7 +1549,7 @@ app.whenReady().then(() => {
// Wait for server health // Wait for server health
let attempts = 0; let attempts = 0;
const maxAttempts = 30; // 30 seconds approx const maxAttempts = 30; // 30 seconds approx
while(attempts < maxAttempts) { while (attempts < maxAttempts) {
const health = await checkServerHealth(); const health = await checkServerHealth();
if (health.ok) { if (health.ok) {
break; break;
@ -1554,9 +1623,9 @@ app.whenReady().then(() => {
} }
}); });
function stripExe(filename: string) { function stripExe(filename: string) {
return filename.replace(/\.exe$/i, ""); return filename.replace(/\.exe$/i, "");
} }
ipcMain.handle("spt:checkGameRunning", async () => { ipcMain.handle("spt:checkGameRunning", async () => {
return await checkGameRunning(); return await checkGameRunning();