microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/extension/services/validationService/checks/devmode.ts
44lines · modeblame
62af5fc4Samriel4 years ago | 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 { executeCommand } from "../util"; | |
| 6 | import { IValidation, ValidationCategoryE, ValidationResultT } from "./types"; | |
| 7 | | |
| 8 | nls.config({ | |
| 9 | messageFormat: nls.MessageFormat.bundle, | |
| 10 | bundleFormat: nls.BundleFormat.standalone, | |
| 11 | })(); | |
| 12 | const toLocale = nls.loadMessageBundle(); | |
| 13 | | |
| 14 | const label = "DeveloperMode"; | |
| 15 | | |
| 16 | async function test(): Promise<ValidationResultT> { | |
| 17 | const command = | |
| 18 | "reg query HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AppModelUnlock /v AllowDevelopmentWithoutDevLicense"; | |
| 19 | const data = await executeCommand(command); | |
| 20 | if (data.stdout) { | |
| 21 | if (data.stdout.includes(" 0x1")) | |
| 22 | return { | |
| 23 | status: "success", | |
| 24 | }; | |
| 25 | } | |
| 26 | | |
| 27 | return { | |
| 28 | status: "failure", | |
| 29 | comment: "Developer mode is disabled", | |
| 30 | }; | |
| 31 | } | |
| 32 | | |
| 33 | const main: IValidation = { | |
| 34 | label, | |
| 35 | platform: ["win32"], | |
| 36 | description: toLocale( | |
| 37 | "DeveloperModeTestDescription", | |
| 38 | "Required for launching and debugging RNW apps", | |
| 39 | ), | |
| 40 | category: ValidationCategoryE.Windows, | |
| 41 | exec: test, | |
| 42 | }; | |
| 43 | | |
| 44 | export default main; |