microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/extension/commands/expoDoctor.ts
25lines · 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 assert = require("assert"); |
| 5 | import { ErrorHelper } from "../../common/error/errorHelper"; |
| 6 | import { InternalErrorCode } from "../../common/error/internalErrorCode"; |
| 7 | import { ChildProcess } from "../../common/node/childProcess"; |
| 8 | import { OutputChannelLogger } from "../log/OutputChannelLogger"; |
| 9 | import { ReactNativeCommand } from "./util/reactNativeCommand"; |
| 10 | |
| 11 | const logger = OutputChannelLogger.getMainChannel(); |
| 12 | export class expoDoctor extends ReactNativeCommand { |
| 13 | codeName = "expoDoctor"; |
| 14 | label = "Expo Doctor"; |
| 15 | error = ErrorHelper.getInternalError(InternalErrorCode.FailedToRunExpoDoctor); |
| 16 | |
| 17 | async baseFn(): Promise<void> { |
| 18 | assert(this.project); |
| 19 | const projectRootPath = this.project.getPackager().getProjectPath(); |
| 20 | const res = await new ChildProcess().exec("npx expo-doctor", { cwd: projectRootPath }); |
| 21 | logger.info("Running diagnostics..."); |
| 22 | const outcome = await res.outcome; |
| 23 | logger.info(outcome); |
| 24 | } |
| 25 | } |