microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/rn-extension.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 | import * as vscode from 'vscode'; |
| 4 | import {ReactNativeProjectHelper} from './utils/reactNativeProjectHelper'; |
| 5 | import {ReactNativeCommandHelper} from './utils/reactNativeCommandHelper'; |
| 6 | |
| 7 | export function activate(context: vscode.ExtensionContext): void { |
| 8 | // TODO: Get the project root (vscode.workspace.rootPath) and return if it is not a react-native project |
| 9 | // check if package.json of user project has dependency on react-native |
| 10 | |
| 11 | |
| 12 | // Register react native commands |
| 13 | context.subscriptions.push(vscode.commands.registerCommand('reactNative.runAndroid', |
| 14 | () => ReactNativeCommandHelper.executeReactNativeCommand(vscode.workspace.rootPath, "runAndroid"))); |
| 15 | context.subscriptions.push(vscode.commands.registerCommand('reactNative.runIos', |
| 16 | () => ReactNativeCommandHelper.executeReactNativeCommand(vscode.workspace.rootPath, "runIos"))); |
| 17 | context.subscriptions.push(vscode.commands.registerCommand('reactNative.startPackager', |
| 18 | () => ReactNativeCommandHelper.executeReactNativeCommand(vscode.workspace.rootPath, "startPackager"))); |
| 19 | context.subscriptions.push(vscode.commands.registerCommand('reactNative.stopPackager', |
| 20 | () => ReactNativeCommandHelper.executeReactNativeCommand(vscode.workspace.rootPath, "stopPackager"))); |
| 21 | |
| 22 | } |