microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
src/common/extensionHelper.ts
14lines · 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 path from "path"; |
| 5 | import * as fs from "fs"; |
| 6 | |
| 7 | export function getExtensionVersion() { |
| 8 | const projectRoot = path.join(__dirname, "..", ".."); |
| 9 | return JSON.parse(fs.readFileSync(path.join(projectRoot, "package.json"), "utf-8")).version; |
| 10 | } |
| 11 | |
| 12 | export function generateRandomPortNumber() { |
| 13 | return Math.round(Math.random() * 40000 + 3000); |
| 14 | } |
| 15 | |