From 7119d228376a848f7c73f618efee5e06b7d46d70 Mon Sep 17 00:00:00 2001 From: Marius456 Date: Wed, 4 Dec 2024 13:03:34 +0200 Subject: [PATCH 1/2] add kaios default target --- packages/sdk-kaios/src/deviceManager.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/sdk-kaios/src/deviceManager.ts b/packages/sdk-kaios/src/deviceManager.ts index a65799dfa..5c135db61 100644 --- a/packages/sdk-kaios/src/deviceManager.ts +++ b/packages/sdk-kaios/src/deviceManager.ts @@ -11,12 +11,14 @@ import { logWarning, chalk, } from '@rnv/core'; +import { updateDefaultTargets } from '@rnv/sdk-utils'; import path from 'path'; export const launchKaiOSSimulator = async (target: string | boolean) => { const c = getContext(); logDefault(`launchKaiOSSimulator: ${target}`); - + if (!c.platform) return; + const defaultTarget = c.buildConfig.defaultTargets?.[c.platform]; const kaiosSdkPath = getRealPath(c.buildConfig?.sdks?.KAIOS_SDK); if (!kaiosSdkPath) { @@ -35,11 +37,18 @@ export const launchKaiOSSimulator = async (target: string | boolean) => { choices: availableSimulatorVersions, }); target = selectedSimulator; + if (!defaultTarget || defaultTarget !== selectedSimulator) { + await updateDefaultTargets(c, selectedSimulator); + } } else if (typeof target === 'string' && !availableSimulatorVersions.includes(target)) { logWarning( - `Target with name ${chalk().red(target)} does not exist. You can update it here: ${chalk().cyan( - c.paths.dotRnv.config - )}` + `${ + defaultTarget && !c.program.opts().target + ? `The default target specified in ${chalk().cyan(c.paths.dotRnv.config)} or ${chalk().cyan( + c.paths.project.configLocal + )}` + : 'Target' + } with name ${chalk().red(target)} does not exist.` ); await launchKaiOSSimulator(true); return true; From 5b16083df4b403c9bb7e4a741c290c0a1eb6c95e Mon Sep 17 00:00:00 2001 From: Marius456 Date: Wed, 4 Dec 2024 21:52:00 +0200 Subject: [PATCH 2/2] fix false target --- packages/sdk-kaios/src/deviceManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sdk-kaios/src/deviceManager.ts b/packages/sdk-kaios/src/deviceManager.ts index 5c135db61..1e14fa44d 100644 --- a/packages/sdk-kaios/src/deviceManager.ts +++ b/packages/sdk-kaios/src/deviceManager.ts @@ -29,7 +29,7 @@ export const launchKaiOSSimulator = async (target: string | boolean) => { (directory) => directory.toLowerCase().indexOf('kaios') !== -1 ); - if (target === true) { + if (typeof target === 'boolean') { const { selectedSimulator } = await inquirerPrompt({ name: 'selectedSimulator', type: 'list',