UNPKG

hdckit

Version:

A pure Node.js client for the OpenHarmony Device Connector

28 lines (27 loc) 1.15 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.UninstallCommand = exports.InstallCommand = void 0; const ExecCommand_1 = __importDefault(require("../ExecCommand")); const path_1 = __importDefault(require("path")); const contain_1 = __importDefault(require("licia/contain")); class InstallCommand extends ExecCommand_1.default { async execute(hap) { const { stdout } = await this.run(['install', path_1.default.resolve(hap)]); if (!(0, contain_1.default)(stdout, 'install bundle successfully')) { throw new Error(stdout); } } } exports.InstallCommand = InstallCommand; class UninstallCommand extends ExecCommand_1.default { async execute(bundleName) { const { stdout } = await this.run(['uninstall', bundleName]); if (!(0, contain_1.default)(stdout, 'uninstall bundle successfully')) { throw new Error('Uninstall bundle failed'); } } } exports.UninstallCommand = UninstallCommand;