@wocker/ws
Version:
Docker workspace for web projects
87 lines (86 loc) • 3.81 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginController = void 0;
const core_1 = require("@wocker/core");
const PluginService_1 = require("../services/PluginService");
let PluginController = class PluginController {
constructor(appConfigService, pluginService) {
this.appConfigService = appConfigService;
this.pluginService = pluginService;
}
async list() {
return this.pluginService.getPluginsTable();
}
async add(addName, beta) {
await this.pluginService.install(addName, beta);
}
async remove(removeName) {
await this.pluginService.uninstall(removeName);
}
async update() {
await this.pluginService.update();
}
getInstalledPlugins() {
return this.appConfigService.config.plugins.map(p => p.name);
}
};
exports.PluginController = PluginController;
__decorate([
(0, core_1.Command)("plugins"),
(0, core_1.Description)("Plugins list"),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], PluginController.prototype, "list", null);
__decorate([
(0, core_1.Command)("plugin:add <name>"),
(0, core_1.Command)("plugin:install <name>"),
(0, core_1.Description)("Install a plugin by specifying its name"),
__param(0, (0, core_1.Param)("name")),
__param(1, (0, core_1.Option)("beta", {
type: "boolean",
alias: "d",
description: "Use the beta version of the plugin (if a beta version exists). Defaults to the latest stable version."
})),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, Boolean]),
__metadata("design:returntype", Promise)
], PluginController.prototype, "add", null);
__decorate([
(0, core_1.Command)("plugin:remove <name>"),
__param(0, (0, core_1.Param)("name")),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], PluginController.prototype, "remove", null);
__decorate([
(0, core_1.Command)("plugin:update [name]"),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], PluginController.prototype, "update", null);
__decorate([
(0, core_1.Completion)("name", "plugin:update [name]"),
(0, core_1.Completion)("name", "plugin:remove <name>"),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Array)
], PluginController.prototype, "getInstalledPlugins", null);
exports.PluginController = PluginController = __decorate([
(0, core_1.Controller)(),
(0, core_1.Description)("Plugin commands"),
__metadata("design:paramtypes", [core_1.AppConfigService,
PluginService_1.PluginService])
], PluginController);