UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

49 lines 1.63 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const semver_1 = __importDefault(require("semver")); const CommandService_1 = __importDefault(require("../../../services/CommandService")); class VsCodeService extends CommandService_1.default { /** Returns whether or not vscode is installed */ async isInstalled() { const isInstalled = false; try { const { stdout } = await this.execute('code', { args: ['--version'], }); const lines = stdout.split('\n'); if (lines && lines[0] && semver_1.default.satisfies(lines[0], `>=${VSCODE_MINIMUM_VERSION}`)) { return true; } } catch (e) { } return isInstalled; } async getVSCodeExtensions() { let extensions = []; try { const { stdout } = await this.execute('code', { args: ['--list-extensions'], }); extensions = stdout.split('\n'); } catch (e) { } return extensions; } async installExtensions(extensionIds) { let args = []; extensionIds.forEach((eId) => { args = args.concat('--install-extension', eId); }); await this.execute('code', { args, }); } } exports.default = VsCodeService; const VSCODE_MINIMUM_VERSION = '1.44.0'; //# sourceMappingURL=VsCodeService.js.map