UNPKG

@wocker/ws

Version:

Docker workspace for web projects

957 lines (956 loc) 35.5 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); 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 __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); 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); } }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProjectController = void 0; const core_1 = require("@wocker/core"); const utils_1 = require("@wocker/utils"); const cli_table3_1 = __importDefault(require("cli-table3")); const yoctocolors_cjs_1 = __importDefault(require("yoctocolors-cjs")); const Path = __importStar(require("path")); const async_mutex_1 = require("async-mutex"); const docker_1 = require("../modules/docker"); const project_1 = require("../modules/project"); let ProjectController = class ProjectController { constructor(appConfigService, processService, eventService, projectService, projectRepository, logService, dockerService) { this.appConfigService = appConfigService; this.processService = processService; this.eventService = eventService; this.projectService = projectService; this.projectRepository = projectRepository; this.logService = logService; this.dockerService = dockerService; } async getProjectNames() { const projects = this.projectRepository.search(); return projects.map((project) => { return project.name; }); } async getScriptNames() { try { const project = this.projectService.get(); return Object.keys(project.scripts); } catch (err) { return []; } } async init(name, type) { const fs = new core_1.FileSystem(this.processService.pwd()); let project = this.projectRepository.searchOne({ path: fs.path() }); if (!project) { project = this.projectRepository.fromObject({ path: fs.path() }); } project.path = fs.path(); if (name) { project.name = name; } if (!name || !project.name) { project.name = await (0, utils_1.promptInput)({ required: "Project name is required", message: "Project name", type: "text", default: project.name || Path.basename(project.path), validate: (name) => { if (typeof name !== "string") { return true; } const otherProject = this.projectRepository.searchOne({ name }); if (otherProject && otherProject.path !== project.path) { return `Project "${name}" already exists`; } return true; } }); project.addDomain(project.containerName); } if (type) { project.type = type; } const mapTypes = this.appConfigService.getProjectTypes(); if (!type || !project.type || !mapTypes[project.type]) { project.type = await (0, utils_1.promptSelect)({ message: "Project type", required: true, options: mapTypes, default: project.type }); } switch (project.type) { case core_1.PROJECT_TYPE_DOCKERFILE: { const files = fs.readdir(); const dockerfiles = files.filter((fileName) => { if (new RegExp("^(.*)\\.dockerfile$").test(fileName)) { return true; } return new RegExp("^Dockerfile(\\..*)?").test(fileName); }); if (dockerfiles.length === 0) { throw new Error("Dockerfiles not found"); } project.dockerfile = await (0, utils_1.promptSelect)({ message: "Dockerfile", required: true, options: dockerfiles.map((dockerfile) => { return { value: dockerfile }; }), default: project.dockerfile }); break; } case core_1.PROJECT_TYPE_IMAGE: { project.imageName = await (0, utils_1.promptInput)({ message: "Image name", required: true, default: project.imageName }); break; } case core_1.PROJECT_TYPE_COMPOSE: { const composeFiles = fs.readdir().filter((file) => { return /docker-compose\./.test(file); }); if (composeFiles.length === 0) { throw new Error("docker-compose files not found"); } project.composefile = await (0, utils_1.promptSelect)({ message: "Docker compose", required: true, options: composeFiles, default: project.composefile }); break; } case core_1.PROJECT_TYPE_PRESET: break; default: throw new Error("Invalid project type"); } await this.eventService.emit("project:init", project); project.save(); } async destroy(name) { const project = this.projectService.get(name); await this.projectService.stop(project); this.appConfigService.removeProject(project.id); this.appConfigService.save(); this.appConfigService.fs.rm(`projects/${project.id}`, { recursive: true }); } async projectList(all) { const table = new cli_table3_1.default({ head: ["Name", "Type", "Status"], colAligns: ["left", "center", "center"] }); const projects = this.projectRepository.search(); for (const project of projects) { const container = await this.dockerService.getContainer(project.containerName); if (!container) { if (all) { table.push([project.name, project.type, "-"]); } continue; } const { State: { Status = "stopped" } = {} } = await container.inspect(); table.push([project.name, project.type, Status]); } return table.toString(); } async domains(name) { const project = this.projectService.get(name); const table = new cli_table3_1.default({ head: [yoctocolors_cjs_1.default.yellow("Domain")] }); for (const domain of project.domains) { table.push([domain]); } return table.toString(); } async addDomain(addDomains, name) { const project = this.projectService.get(name); for (const domain of addDomains) { project.addDomain(domain); } project.save(); } async setDomains(domains, name) { const project = this.projectService.get(name); project.clearDomains(); for (const domain of domains) { project.addDomain(domain); } project.save(); } async removeDomain(removeDomains, name) { const project = this.projectService.get(name); for (const domain of removeDomains) { project.removeDomain(domain); } project.save(); } async clearDomain(name) { const project = this.projectService.get(name); project.clearDomains(); project.save(); } async ports(name) { const project = this.projectService.get(name); const table = new cli_table3_1.default({ head: ["Ports"] }); for (const port of project.ports || []) { table.push([port]); } return table.toString(); } async addPort(hostPort, containerPort, name) { const project = this.projectService.get(name); project.linkPort(parseInt(hostPort), parseInt(containerPort)); project.save(); } async removePort(hostPort, containerPort, name) { const project = this.projectService.get(name); project.unlinkPort(parseInt(hostPort), parseInt(containerPort)); project.save(); } async clearPorts(name) { const project = this.projectService.get(name); if (project.ports) { delete project.ports; project.save(); } } async configList(name, global) { let env; if (!global) { const project = this.projectService.get(name); env = project.env || {}; } else { const config = this.appConfigService.config; env = config.env || {}; } const table = new cli_table3_1.default({ head: ["KEY", "VALUE"] }); for (const i in env) { table.push([i, env[i]]); } return table.toString(); } async configGet(keys, name, global) { let config = global ? this.appConfigService.config : this.projectService.get(name); const table = new cli_table3_1.default({ head: ["KEY", "VALUE"] }); for (const key of keys) { const value = config.getEnv(key, ""); if (!value) { continue; } table.push([key, value]); } return table.toString(); } async configSet(variables, name, global) { if (global) { for (const variable of variables) { const [key, value] = variable.split("="); if (!value) { console.info(yoctocolors_cjs_1.default.yellow(`No value for "${key}"`)); continue; } this.appConfigService.config.setEnv(key.trim(), value.trim()); } return; } const project = this.projectService.get(name); for (const variable of variables) { const [key, value] = variable.split("="); if (!value) { console.info(yoctocolors_cjs_1.default.yellow(`No value for "${key}"`)); continue; } project.setEnv(key, value); } project.save(); } async configUnset(configs, name, global) { const env = configs.reduce((env, config) => { const [key] = config.split("="); env[key.trim()] = null; return env; }, {}); if (global) { return; } const project = this.projectService.get(name); for (const i in env) { project.unsetEnv(i); } project.save(); } async buildArgsList(name) { const project = this.projectService.get(name); const table = new cli_table3_1.default({ head: ["KEY", "VALUE"] }); const buildArgs = project.buildArgs || {}; for (const i in buildArgs) { table.push([i, typeof buildArgs[i] === "string" ? buildArgs[i] : JSON.stringify(buildArgs[i])]); } return table.toString(); } async buildArgsGet(args, name) { const project = this.projectService.get(name); const table = new cli_table3_1.default({ head: ["KEY", "VALUE"] }); for (const key of args) { if (project.buildArgs && typeof project.buildArgs[key] !== "undefined") { const value = project.buildArgs[key] || ""; table.push([key, value]); } } return table.toString(); } async buildArgsSet(args, name) { const project = this.projectService.get(name); const buildArgs = args.reduce((env, config) => { let [, key = "", value = ""] = config.split(/^([^=]+)=(.*)$/); key = key.trim(); value = value.trim(); if (key) { env[key] = value; } return env; }, {}); for (const key in buildArgs) { if (!project.buildArgs) { project.buildArgs = {}; } project.buildArgs[key] = buildArgs[key]; } project.save(); } async buildArgsUnset(args, name) { const project = this.projectService.get(name); const buildArgs = args.reduce((env, config) => { let [, key = "", value = ""] = config.split(/^([^=]+)(?:=(.*))?$/); key = key.trim(); value = value.trim(); env[key] = value; return env; }, {}); for (const key in buildArgs) { if (!project.buildArgs) { break; } if (typeof project.buildArgs[key] !== "undefined") { delete project.buildArgs[key]; } } project.save(); } async volumeList(name) { const project = this.projectService.get(name); const table = new cli_table3_1.default({ head: ["Volume"] }); const volumes = project.volumes || []; for (const volume of volumes) { table.push([volume]); } return table.toString(); } async volumeMount(volumes, name) { const project = this.projectService.get(name); if (Array.isArray(volumes) && volumes.length > 0) { project.volumeMount(...volumes); project.save(); } } async volumeUnmount(volumes, name) { const project = this.projectService.get(name); if (Array.isArray(volumes) && volumes.length > 0) { project.volumeUnmount(...volumes); project.save(); } } async extraHostList(name) { const project = this.projectService.get(name); if (!project.extraHosts) { return "No extra hosts found"; } const table = new cli_table3_1.default({ head: ["Host", "Domain"] }); for (const host in project.extraHosts) { table.push([ host, project.extraHosts[host] ]); } return table.toString(); } async addExtraHost(extraHost, extraDomain, name) { const project = this.projectService.get(name); project.addExtraHost(extraHost, extraDomain); project.save(); } async removeExtraHost(extraHost, name) { const project = this.projectService.get(name); project.removeExtraHost(extraHost); project.save(); } async attach(name) { const project = this.projectService.get(name); await this.dockerService.attach(project.containerName); } async run(script, args, name) { const project = this.projectService.get(name); if (!project.scripts || !project.scripts[script]) { throw new Error(`Script ${script} not found`); } const container = await this.dockerService.getContainer(project.containerName); if (!container) { throw new Error("The project is not started"); } const exec = await container.exec({ AttachStdin: true, AttachStdout: true, AttachStderr: true, Tty: process.stdin.isTTY, Cmd: ["bash", "-i", "-c", [project.scripts[script], ...args || []].join(" ")] }); const stream = await exec.start({ hijack: true, stdin: true, Tty: process.stdin.isTTY }); await this.dockerService.attachStream(stream); } async logs(name, global, detach, follow, clear) { if (global) { if (clear) { this.logService.clear(); } const prepareLog = (str) => { return str.replace(/^\[.*]\s([^:]+):\s.*$/gm, (substring, type) => { switch (type) { case "debug": return yoctocolors_cjs_1.default.gray(substring); case "log": return yoctocolors_cjs_1.default.white(substring); case "info": return yoctocolors_cjs_1.default.green(substring); case "warn": case "warning": return yoctocolors_cjs_1.default.yellow(substring); case "error": return yoctocolors_cjs_1.default.red(substring); default: return substring; } }); }; const file = this.appConfigService.fs.open("ws.log", "r"); const stream = file.createReadlineStream({ start: -10 }); stream.on("data", (line) => { process.stdout.write(prepareLog(line)); process.stdout.write("\n"); }); if (follow) { const stats = file.stat(); const watcher = this.appConfigService.fs.watch("ws.log"); const mutex = new async_mutex_1.Mutex(); let position = stats.size; watcher.on("change", async () => { await mutex.acquire(); try { const stats = file.stat(); if (stats.size < position) { console.info("file truncated"); position = 0; } const buffer = file.readBytes(position); position += buffer.length; process.stdout.write(prepareLog(buffer.toString("utf-8"))); } finally { mutex.release(); } }); } return; } const project = this.projectService.get(name); await this.projectService.logs(project, detach); } }; exports.ProjectController = ProjectController; __decorate([ (0, core_1.Completion)("name"), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise) ], ProjectController.prototype, "getProjectNames", null); __decorate([ (0, core_1.Completion)("script"), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise) ], ProjectController.prototype, "getScriptNames", null); __decorate([ (0, core_1.Command)("init"), (0, core_1.Description)("Project initialisation"), __param(0, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __param(1, (0, core_1.Option)("type", { type: "string", alias: "t", description: "Project type" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "init", null); __decorate([ (0, core_1.Command)("destroy [name]"), (0, core_1.Description)("Permanently destroy a project"), __param(0, (0, core_1.Param)("name")), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "destroy", null); __decorate([ (0, core_1.Command)("ps"), (0, core_1.Description)("Projects list"), __param(0, (0, core_1.Option)("all", { type: "boolean", alias: "a", description: "All projects" })), __metadata("design:type", Function), __metadata("design:paramtypes", [Boolean]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "projectList", null); __decorate([ (0, core_1.Command)("domains"), (0, core_1.Description)("Project domain list"), __param(0, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "domains", null); __decorate([ (0, core_1.Command)("domain:add [...domains]"), (0, core_1.Description)("Adding project domain"), __param(0, (0, core_1.Param)("domains")), __param(1, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [Array, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "addDomain", null); __decorate([ (0, core_1.Command)("domain:set [...domains]"), (0, core_1.Description)("Setting project domains"), __param(0, (0, core_1.Param)("domains")), __param(1, (0, core_1.Option)("name", { type: "string", alias: "n", description: "Project name" })), __metadata("design:type", Function), __metadata("design:paramtypes", [Array, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "setDomains", null); __decorate([ (0, core_1.Command)("domain:remove [...domains]"), (0, core_1.Description)("Removing project domain"), __param(0, (0, core_1.Param)("domains")), __param(1, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [Array, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "removeDomain", null); __decorate([ (0, core_1.Command)("domain:clear"), (0, core_1.Description)("Clearing project domain"), __param(0, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "clearDomain", null); __decorate([ (0, core_1.Command)("ports"), __param(0, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "ports", null); __decorate([ (0, core_1.Command)("port:add <host-port>:<container-port>"), __param(0, (0, core_1.Param)("host-port")), __param(1, (0, core_1.Param)("container-port")), __param(2, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "addPort", null); __decorate([ (0, core_1.Command)("port:remove <host-port>:<container-port>"), __param(0, (0, core_1.Param)("host-port")), __param(1, (0, core_1.Param)("container-port")), __param(2, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "removePort", null); __decorate([ (0, core_1.Command)("port:clear"), __param(0, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "clearPorts", null); __decorate([ (0, core_1.Command)("config"), __param(0, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __param(1, (0, core_1.Option)("global", { type: "boolean", alias: "g" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Boolean]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "configList", null); __decorate([ (0, core_1.Command)("config:get [...key]"), __param(0, (0, core_1.Param)("key")), __param(1, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __param(2, (0, core_1.Option)("global", { type: "boolean", alias: "g" })), __metadata("design:type", Function), __metadata("design:paramtypes", [Array, String, Boolean]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "configGet", null); __decorate([ (0, core_1.Command)("config:set [...configs]"), (0, core_1.Description)("Setting env variables"), __param(0, (0, core_1.Param)("configs")), __param(1, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __param(2, (0, core_1.Option)("global", { type: "boolean", alias: "g" })), __metadata("design:type", Function), __metadata("design:paramtypes", [Array, String, Boolean]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "configSet", null); __decorate([ (0, core_1.Command)("config:unset [...configs]"), __param(0, (0, core_1.Param)("configs")), __param(1, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __param(2, (0, core_1.Option)("global", { type: "boolean", alias: "g" })), __metadata("design:type", Function), __metadata("design:paramtypes", [Array, String, Boolean]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "configUnset", null); __decorate([ (0, core_1.Command)("build-args"), __param(0, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "buildArgsList", null); __decorate([ (0, core_1.Command)("build-args:get [...buildArgs]"), __param(0, (0, core_1.Param)("buildArgs")), __param(1, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [Array, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "buildArgsGet", null); __decorate([ (0, core_1.Command)("build-args:set [...buildArgs]"), __param(0, (0, core_1.Param)("buildArgs")), __param(1, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [Array, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "buildArgsSet", null); __decorate([ (0, core_1.Command)("build-args:unset [...buildArgs]"), __param(0, (0, core_1.Param)("buildArgs")), __param(1, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [Array, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "buildArgsUnset", null); __decorate([ (0, core_1.Command)("volumes"), __param(0, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "volumeList", null); __decorate([ (0, core_1.Command)("volume:mount [...volumes]"), __param(0, (0, core_1.Param)("volumes")), __param(1, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [Array, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "volumeMount", null); __decorate([ (0, core_1.Command)("volume:unmount [...volumes]"), __param(0, (0, core_1.Param)("volumes")), __param(1, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [Array, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "volumeUnmount", null); __decorate([ (0, core_1.Command)("extra-hosts"), (0, core_1.Description)("List of extra hosts"), __param(0, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "extraHostList", null); __decorate([ (0, core_1.Command)("extra-host:add <extraHost>:<extraDomain>"), (0, core_1.Description)("Adding extra host"), __param(0, (0, core_1.Param)("extraHost")), __param(1, (0, core_1.Param)("extraDomain")), __param(2, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "addExtraHost", null); __decorate([ (0, core_1.Command)("extra-host:remove <extraHost>"), (0, core_1.Description)("Removing extra host"), __param(0, (0, core_1.Param)("extraHost")), __param(1, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "removeExtraHost", null); __decorate([ (0, core_1.Command)("attach"), (0, core_1.Description)("Attach local standard input, output, and error streams to a running container"), __param(0, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "attach", null); __decorate([ (0, core_1.Command)("run <script> [...args]"), __param(0, (0, core_1.Param)("script")), __param(1, (0, core_1.Param)("args")), __param(2, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Array, String]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "run", null); __decorate([ (0, core_1.Command)("logs"), __param(0, (0, core_1.Option)("name", { type: "string", alias: "n", description: "The name of the project" })), __param(1, (0, core_1.Option)("global", { type: "boolean", alias: "g" })), __param(2, (0, core_1.Option)("detach", { type: "boolean", alias: "d", description: "Detach" })), __param(3, (0, core_1.Option)("follow", { type: "boolean", alias: "f" })), __param(4, (0, core_1.Option)("clear", "c")), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Boolean, Boolean, Boolean, Boolean]), __metadata("design:returntype", Promise) ], ProjectController.prototype, "logs", null); exports.ProjectController = ProjectController = __decorate([ (0, core_1.Controller)(), (0, core_1.Description)("Project commands"), __metadata("design:paramtypes", [core_1.AppConfigService, core_1.ProcessService, core_1.EventService, project_1.ProjectService, project_1.ProjectRepository, core_1.LogService, docker_1.DockerService]) ], ProjectController);