microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/extension/commands/launchIosSimulator.ts
22lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. |
| 3 | |
| 4 | import { ErrorHelper } from "../../common/error/errorHelper"; |
| 5 | import { InternalErrorCode } from "../../common/error/internalErrorCode"; |
| 6 | import { TargetType } from "../generalPlatform"; |
| 7 | import { IOSTargetManager } from "../ios/iOSTargetManager"; |
| 8 | import { Command } from "./util/command"; |
| 9 | |
| 10 | export class LaunchIOSSimulator extends Command { |
| 11 | codeName = "launchIOSSimulator"; |
| 12 | label = "Launch iOS Simulator"; |
| 13 | requiresProject = false; |
| 14 | |
| 15 | error = ErrorHelper.getInternalError(InternalErrorCode.FailedToStartIOSSimulator); |
| 16 | |
| 17 | async baseFn(): Promise<void> { |
| 18 | const targetManager = new IOSTargetManager(); |
| 19 | await targetManager.collectTargets(TargetType.Simulator); |
| 20 | await targetManager.selectAndPrepareTarget(target => target.isVirtualTarget); |
| 21 | } |
| 22 | } |