Skip to content

Commit

Permalink
add kaios default target
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius456 committed Dec 4, 2024
1 parent 8d0c0a6 commit 7119d22
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/sdk-kaios/src/deviceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit 7119d22

Please sign in to comment.