microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/extension/services/validationService/checks/expoCli.ts
42lines · 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 * as nls from "vscode-nls"; |
| 5 | import { basicCheck, createNotFoundMessage } from "../util"; |
| 6 | import { ValidationCategoryE, IValidation, ValidationResultT } from "./types"; |
| 7 | |
| 8 | nls.config({ |
| 9 | messageFormat: nls.MessageFormat.bundle, |
| 10 | bundleFormat: nls.BundleFormat.standalone, |
| 11 | })(); |
| 12 | |
| 13 | const toLocale = nls.loadMessageBundle(); |
| 14 | |
| 15 | const label = "Expo CLI"; |
| 16 | |
| 17 | async function test(): Promise<ValidationResultT> { |
| 18 | const result = await basicCheck({ |
| 19 | command: "expo-cli", |
| 20 | }); |
| 21 | |
| 22 | if (!result.exists) { |
| 23 | return { |
| 24 | status: "failure", |
| 25 | comment: createNotFoundMessage(label), |
| 26 | }; |
| 27 | } |
| 28 | |
| 29 | return { status: "success" }; |
| 30 | } |
| 31 | |
| 32 | const main: IValidation = { |
| 33 | label, |
| 34 | description: toLocale( |
| 35 | "ExpoCliTestDescription", |
| 36 | "Required for installing and managing Expo applications", |
| 37 | ), |
| 38 | category: ValidationCategoryE.Expo, |
| 39 | exec: test, |
| 40 | }; |
| 41 | |
| 42 | export default main; |
| 43 | |