mobile-cli-lib
Version:
common lib used by different CLI
38 lines (37 loc) • 1.59 kB
JavaScript
;
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var plugins_source_base_1 = require("./plugins-source-base");
var Future = require("fibers/future");
var NpmPluginsSource = (function (_super) {
__extends(NpmPluginsSource, _super);
function NpmPluginsSource($progressIndicator, $logger, $childProcess, $hostInfo, $npmService, $errors) {
_super.call(this, $progressIndicator, $logger);
this.$childProcess = $childProcess;
this.$hostInfo = $hostInfo;
this.$npmService = $npmService;
this.$errors = $errors;
}
Object.defineProperty(NpmPluginsSource.prototype, "progressIndicatorMessage", {
get: function () {
return "Searching for plugins with npm search command.";
},
enumerable: true,
configurable: true
});
NpmPluginsSource.prototype.getPlugins = function (page, count) {
var skip = page * count;
return Future.fromResult(_.slice(this.plugins, skip, skip + count));
};
NpmPluginsSource.prototype.initializeCore = function (projectDir, keywords) {
var _this = this;
return (function () {
_this.plugins = _this.$npmService.search(_this.projectDir, keywords).wait();
}).future()();
};
return NpmPluginsSource;
}(plugins_source_base_1.PluginsSourceBase));
exports.NpmPluginsSource = NpmPluginsSource;