diff --git a/src/backend/common/envEngineInfoSchema.ts b/src/backend/common/envEngineInfoSchema.ts deleted file mode 100644 index 75c9e0dda3..0000000000 --- a/src/backend/common/envEngineInfoSchema.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { z } from "zod"; - -import { engineIdSchema } from "@/type/preload"; - -/** .envに書くエンジン情報のスキーマ */ -export const envEngineInfoSchema = z.object({ - uuid: engineIdSchema, - host: z.string(), - name: z.string(), - executionEnabled: z.boolean(), // FIXME: typeがurlのときのみ必要 - executionFilePath: z.string(), // FIXME: typeがpathのときは必須 - executionArgs: z.array(z.string()), - path: z.string().optional(), // FIXME: typeがpathで、アンインストール可能なときは必須 - type: z.union([z.literal("path"), z.literal("downloadVvpp")]).default("path"), - latestUrl: z.string().optional(), // FIXME: typeがdownloadVvppのときは必須 -}); -export type EnvEngineInfo = z.infer; - -/** 環境変数を経由して.envを読み込む */ -export function loadEnvEngineInfos(): EnvEngineInfo[] { - const defaultEngineInfosEnv = - import.meta.env.VITE_DEFAULT_ENGINE_INFOS ?? "[]"; - - const envSchema = envEngineInfoSchema.array(); - return envSchema.parse(JSON.parse(defaultEngineInfosEnv)); -} diff --git a/src/backend/electron/manager/engineInfoManager.ts b/src/backend/electron/manager/engineInfoManager.ts index 2a30f2314c..325efe7d02 100644 --- a/src/backend/electron/manager/engineInfoManager.ts +++ b/src/backend/electron/manager/engineInfoManager.ts @@ -15,15 +15,17 @@ import { } from "@/type/preload"; import { AltPortInfos } from "@/store/type"; import { BaseConfigManager } from "@/backend/common/ConfigManager"; -import { EnvEngineInfo } from "@/backend/common/envEngineInfoSchema"; import { UnreachableError } from "@/type/utility"; -import { loadEnvEngineInfos } from "@/domain/defaultEngine/envEngineInfo"; +import { + EnvEngineInfoType, + loadEnvEngineInfos, +} from "@/domain/defaultEngine/envEngineInfo"; /** * デフォルトエンジンの情報を取得する */ function fetchDefaultEngineInfos( - envEngineInfos: EnvEngineInfo[], + envEngineInfos: EnvEngineInfoType[], defaultEngineDir: string, ): EngineInfo[] { // TODO: envから直接ではなく、envに書いたengine_manifest.jsonから情報を得るようにする diff --git a/src/domain/defaultEngine/envEngineInfo.ts b/src/domain/defaultEngine/envEngineInfo.ts index b28b55b254..a86870265c 100644 --- a/src/domain/defaultEngine/envEngineInfo.ts +++ b/src/domain/defaultEngine/envEngineInfo.ts @@ -11,10 +11,12 @@ export const envEngineInfoSchema = z.object({ uuid: engineIdSchema, host: z.string(), name: z.string(), - executionEnabled: z.boolean(), - executionFilePath: z.string(), + executionEnabled: z.boolean(), // FIXME: typeがurlのときのみ必要 + executionFilePath: z.string(), // FIXME: typeがpathのときは必須 executionArgs: z.array(z.string()), - path: z.string().optional(), + path: z.string().optional(), // FIXME: typeがpathで、アンインストール可能なときは必須 + type: z.union([z.literal("path"), z.literal("downloadVvpp")]).default("path"), + latestUrl: z.string().optional(), // FIXME: typeがdownloadVvppのときは必須 }); export type EnvEngineInfoType = z.infer; diff --git a/tests/unit/domain/defaultEngine/defaultEngine.node.spec.ts b/tests/unit/domain/defaultEngine/defaultEngine.node.spec.ts index a1778e0b53..0d9d431419 100644 --- a/tests/unit/domain/defaultEngine/defaultEngine.node.spec.ts +++ b/tests/unit/domain/defaultEngine/defaultEngine.node.spec.ts @@ -2,7 +2,7 @@ import path from "path"; import fs from "fs"; -import { fetchDefaultEngineInfos } from "@/domain/defaultEngine/latetDefaultEngine"; +import { fetchDefaultEngineUpdateInfo } from "@/domain/defaultEngine/latetDefaultEngine"; const currentDir = "tests/unit/domain/defaultEngine";