@wocker/ws 1.0.25 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/AppModule.d.ts +0 -4
- package/lib/AppModule.js +6 -44
- package/lib/env.d.ts +2 -3
- package/lib/env.js +12 -42
- package/lib/main.d.ts +2 -3
- package/lib/main.js +23 -25
- package/lib/makes/GithubClient.d.ts +24 -3
- package/lib/makes/GithubClient.js +20 -6
- package/lib/makes/Version.d.ts +22 -0
- package/lib/makes/Version.js +59 -0
- package/lib/makes/VersionRange.d.ts +6 -0
- package/lib/makes/VersionRange.js +18 -0
- package/lib/makes/VersionRule.d.ts +24 -0
- package/lib/makes/VersionRule.js +68 -0
- package/lib/makes/index.d.ts +2 -0
- package/lib/makes/index.js +2 -0
- package/lib/modules/core/index.js +7 -26
- package/lib/modules/dns/controllers/DnsController.d.ts +7 -0
- package/lib/modules/dns/controllers/DnsController.js +47 -0
- package/lib/modules/dns/index.d.ts +4 -0
- package/lib/modules/dns/index.js +41 -0
- package/lib/modules/dns/services/DnsService.d.ts +10 -0
- package/lib/modules/dns/services/DnsService.js +77 -0
- package/lib/modules/docker/services/ComposeService.d.ts +1 -1
- package/lib/modules/docker/services/ComposeService.js +0 -2
- package/lib/modules/docker/services/ContainerService.d.ts +1 -1
- package/lib/modules/docker/services/DockerService.js +0 -1
- package/lib/modules/docker/services/ModemService.d.ts +0 -1
- package/lib/modules/docker/services/ModemService.js +0 -1
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +3 -0
- package/lib/modules/keystore/controllers/KeystoreController.d.ts +0 -3
- package/lib/modules/keystore/controllers/KeystoreController.js +3 -54
- package/lib/modules/keystore/services/KeystoreService.d.ts +1 -0
- package/lib/modules/keystore/services/KeystoreService.js +4 -0
- package/lib/modules/keystore/utils/createEncryptionKey.d.ts +1 -1
- package/lib/modules/package-manager/index.d.ts +5 -0
- package/lib/modules/package-manager/index.js +33 -0
- package/lib/modules/package-manager/providers/NpmProvider.d.ts +7 -0
- package/lib/modules/package-manager/providers/NpmProvider.js +39 -0
- package/lib/modules/package-manager/providers/PnpmProvider.d.ts +7 -0
- package/lib/modules/package-manager/providers/PnpmProvider.js +30 -0
- package/lib/modules/package-manager/providers/YarnProvider.d.ts +7 -0
- package/lib/modules/package-manager/providers/YarnProvider.js +29 -0
- package/lib/modules/package-manager/service/PackageManager.d.ts +10 -0
- package/lib/modules/package-manager/service/PackageManager.js +70 -0
- package/lib/modules/package-manager/service/RegistryService.d.ts +4 -0
- package/lib/{services/NpmService.js → modules/package-manager/service/RegistryService.js} +6 -11
- package/lib/modules/package-manager/types/Package.d.ts +4 -0
- package/lib/modules/package-manager/types/PackageInfo.js +2 -0
- package/lib/modules/package-manager/types/PackageManagerProvider.d.ts +6 -0
- package/lib/modules/package-manager/types/PackageManagerProvider.js +6 -0
- package/lib/{controllers → modules/plugin/controllers}/PluginController.d.ts +2 -2
- package/lib/{controllers → modules/plugin/controllers}/PluginController.js +21 -20
- package/lib/modules/plugin/index.d.ts +4 -0
- package/lib/modules/plugin/index.js +67 -0
- package/lib/{services → modules/plugin/services}/PluginService.d.ts +7 -5
- package/lib/{services → modules/plugin/services}/PluginService.js +38 -40
- package/lib/modules/preset/controllers/PresetController.d.ts +1 -1
- package/lib/modules/preset/controllers/PresetController.js +12 -6
- package/lib/modules/preset/services/PresetService.d.ts +2 -1
- package/lib/modules/preset/services/PresetService.js +73 -13
- package/lib/modules/project/controllers/ProjectController.d.ts +37 -2
- package/lib/modules/project/controllers/ProjectController.js +837 -7
- package/lib/modules/project/controllers/SecretsController.d.ts +8 -0
- package/lib/modules/project/controllers/SecretsController.js +72 -0
- package/lib/modules/project/index.js +5 -1
- package/lib/modules/project/repositories/ProjectRepository.d.ts +3 -6
- package/lib/modules/project/repositories/ProjectRepository.js +9 -28
- package/lib/modules/project/services/ProjectService.d.ts +5 -3
- package/lib/modules/project/services/ProjectService.js +53 -0
- package/lib/modules/proxy/controllers/ProxyController.d.ts +1 -2
- package/lib/modules/proxy/controllers/ProxyController.js +1 -2
- package/lib/modules/proxy/services/CertService.js +1 -1
- package/lib/modules/proxy/services/ProxyService.d.ts +1 -0
- package/lib/modules/proxy/services/ProxyService.js +5 -1
- package/lib/utils/exec.js +4 -1
- package/lib/utils/get-cursor-position.js +1 -1
- package/package.json +14 -15
- package/plugins/dns/Dockerfile +35 -0
- package/plugins/dns/app/Procfile +2 -0
- package/plugins/dns/app/dnsmasq.conf.tmpl +11 -0
- package/plugins/dns/app/dnsmasq.sh +28 -0
- package/plugins/proxmox/Dockerfile +35 -0
- package/plugins/proxy/Dockerfile +23 -0
- package/plugins/proxy/Procfile +2 -0
- package/plugins/proxy/bin/wocker-create-ca +19 -0
- package/plugins/proxy/bin/wocker-create-cert +38 -0
- package/plugins/proxy/bin/wocker-create-domains +21 -0
- package/presets/shopify/Dockerfile +160 -0
- package/presets/shopify/bin/compare-version +3 -0
- package/presets/shopify/config.json +26 -0
- package/presets/shopify/etc/apache2/apache2.conf +230 -0
- package/presets/shopify/etc/apache2/mods-available/mpm_prefork.conf +16 -0
- package/presets/shopify/etc/apache2/sites-available/000-default.conf +21 -0
- package/proto/buildkit.proto +55 -0
- package/proto/solver/pb/ops.proto +443 -0
- package/bin/ws.js +0 -6
- package/lib/controllers/ProjectController.d.ts +0 -44
- package/lib/controllers/ProjectController.js +0 -956
- package/lib/controllers/index.d.ts +0 -5
- package/lib/controllers/index.js +0 -21
- package/lib/services/NpmService.d.ts +0 -5
- package/lib/types/index.d.ts +0 -1
- package/lib/types/index.js +0 -17
- /package/lib/{controllers → modules/core/controllers}/CompletionController.d.ts +0 -0
- /package/lib/{controllers → modules/core/controllers}/CompletionController.js +0 -0
- /package/lib/{controllers → modules/core/controllers}/DebugController.d.ts +0 -0
- /package/lib/{controllers → modules/core/controllers}/DebugController.js +0 -0
- /package/lib/{controllers → modules/core/controllers}/ExperimentalController.d.ts +0 -0
- /package/lib/{controllers → modules/core/controllers}/ExperimentalController.js +0 -0
- /package/lib/{types/PackageInfo.js → modules/package-manager/types/Package.js} +0 -0
- /package/lib/{types → modules/package-manager/types}/PackageInfo.d.ts +0 -0
|
@@ -19,14 +19,149 @@ exports.ProjectController = void 0;
|
|
|
19
19
|
const core_1 = require("@wocker/core");
|
|
20
20
|
const utils_1 = require("@wocker/utils");
|
|
21
21
|
const path_1 = __importDefault(require("path"));
|
|
22
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
23
|
+
const yoctocolors_cjs_1 = __importDefault(require("yoctocolors-cjs"));
|
|
24
|
+
const async_mutex_1 = require("async-mutex");
|
|
22
25
|
const preset_1 = require("../../preset");
|
|
23
26
|
const ProjectService_1 = require("../services/ProjectService");
|
|
24
27
|
let ProjectController = class ProjectController {
|
|
25
|
-
constructor(appConfigService, processService, projectService, presetService) {
|
|
28
|
+
constructor(appConfigService, fs, processService, projectService, presetService, eventService, dockerService, logService) {
|
|
26
29
|
this.appConfigService = appConfigService;
|
|
30
|
+
this.fs = fs;
|
|
27
31
|
this.processService = processService;
|
|
28
32
|
this.projectService = projectService;
|
|
29
33
|
this.presetService = presetService;
|
|
34
|
+
this.eventService = eventService;
|
|
35
|
+
this.dockerService = dockerService;
|
|
36
|
+
this.logService = logService;
|
|
37
|
+
}
|
|
38
|
+
async getProjectNames() {
|
|
39
|
+
const projects = this.projectService.search();
|
|
40
|
+
return projects.map((project) => {
|
|
41
|
+
return project.name;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async getScriptNames() {
|
|
45
|
+
try {
|
|
46
|
+
const project = this.projectService.get();
|
|
47
|
+
return Object.keys(project.scripts);
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async init(name, type) {
|
|
54
|
+
const fs = new core_1.FileSystem(this.processService.pwd());
|
|
55
|
+
let project = this.projectService.searchOne({
|
|
56
|
+
path: fs.path()
|
|
57
|
+
});
|
|
58
|
+
if (!project) {
|
|
59
|
+
project = new core_1.Project({
|
|
60
|
+
type: core_1.PROJECT_TYPE_IMAGE,
|
|
61
|
+
name: fs.basename(),
|
|
62
|
+
path: fs.path()
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
project.path = fs.path();
|
|
66
|
+
if (name) {
|
|
67
|
+
project.name = name;
|
|
68
|
+
}
|
|
69
|
+
if (!name || !project.name) {
|
|
70
|
+
project.name = await (0, utils_1.promptInput)({
|
|
71
|
+
required: "Project name is required",
|
|
72
|
+
message: "Project name",
|
|
73
|
+
type: "text",
|
|
74
|
+
default: project.name || path_1.default.basename(project.path),
|
|
75
|
+
validate: (name) => {
|
|
76
|
+
if (typeof name !== "string") {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
const otherProject = this.projectService.searchOne({
|
|
80
|
+
name
|
|
81
|
+
});
|
|
82
|
+
if (otherProject && otherProject.path !== project.path) {
|
|
83
|
+
return `Project "${name}" already exists`;
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
project.addDomain(project.containerName);
|
|
89
|
+
}
|
|
90
|
+
if (type) {
|
|
91
|
+
project.type = type;
|
|
92
|
+
}
|
|
93
|
+
const mapTypes = this.appConfigService.getProjectTypes();
|
|
94
|
+
if (!type || !project.type || !mapTypes[project.type]) {
|
|
95
|
+
project.type = await (0, utils_1.promptSelect)({
|
|
96
|
+
message: "Project type",
|
|
97
|
+
required: true,
|
|
98
|
+
options: mapTypes,
|
|
99
|
+
default: project.type
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
switch (project.type) {
|
|
103
|
+
case core_1.PROJECT_TYPE_DOCKERFILE: {
|
|
104
|
+
const files = fs.readdir();
|
|
105
|
+
const dockerfiles = files.filter((fileName) => {
|
|
106
|
+
if (new RegExp("^(.*)\\.dockerfile$").test(fileName)) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
return new RegExp("^Dockerfile(\\..*)?").test(fileName);
|
|
110
|
+
});
|
|
111
|
+
if (dockerfiles.length === 0) {
|
|
112
|
+
throw new Error("Dockerfiles not found");
|
|
113
|
+
}
|
|
114
|
+
project.dockerfile = await (0, utils_1.promptSelect)({
|
|
115
|
+
message: "Dockerfile",
|
|
116
|
+
required: true,
|
|
117
|
+
options: dockerfiles.map((dockerfile) => {
|
|
118
|
+
return {
|
|
119
|
+
value: dockerfile
|
|
120
|
+
};
|
|
121
|
+
}),
|
|
122
|
+
default: project.dockerfile
|
|
123
|
+
});
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
case core_1.PROJECT_TYPE_IMAGE: {
|
|
127
|
+
project.imageName = await (0, utils_1.promptInput)({
|
|
128
|
+
message: "Image name",
|
|
129
|
+
required: true,
|
|
130
|
+
default: project.imageName
|
|
131
|
+
});
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
case core_1.PROJECT_TYPE_COMPOSE: {
|
|
135
|
+
const composeFiles = fs.readdir().filter((file) => {
|
|
136
|
+
return /docker-compose\./.test(file);
|
|
137
|
+
});
|
|
138
|
+
if (composeFiles.length === 0) {
|
|
139
|
+
throw new Error("docker-compose files not found");
|
|
140
|
+
}
|
|
141
|
+
project.composefile = await (0, utils_1.promptSelect)({
|
|
142
|
+
message: "Docker compose",
|
|
143
|
+
required: true,
|
|
144
|
+
options: composeFiles,
|
|
145
|
+
default: project.composefile
|
|
146
|
+
});
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
case core_1.PROJECT_TYPE_PRESET:
|
|
150
|
+
break;
|
|
151
|
+
default:
|
|
152
|
+
throw new Error("Invalid project type");
|
|
153
|
+
}
|
|
154
|
+
await this.eventService.emit("project:init", project);
|
|
155
|
+
project.save();
|
|
156
|
+
}
|
|
157
|
+
async destroy(name) {
|
|
158
|
+
const project = this.projectService.get(name);
|
|
159
|
+
await this.projectService.stop(project);
|
|
160
|
+
this.appConfigService.removeProject(project.name);
|
|
161
|
+
this.appConfigService.save();
|
|
162
|
+
this.fs.rm(`projects/${project.name}`, {
|
|
163
|
+
recursive: true
|
|
164
|
+
});
|
|
30
165
|
}
|
|
31
166
|
async start(name, restart, build, attach) {
|
|
32
167
|
const project = this.projectService.get(name);
|
|
@@ -36,6 +171,317 @@ let ProjectController = class ProjectController {
|
|
|
36
171
|
const project = this.projectService.get(name);
|
|
37
172
|
await this.projectService.stop(project);
|
|
38
173
|
}
|
|
174
|
+
async projectList(all) {
|
|
175
|
+
const table = new cli_table3_1.default({
|
|
176
|
+
head: ["Name", "Type", "Path", "Status"],
|
|
177
|
+
colAligns: ["left", "center", "left", "center"]
|
|
178
|
+
});
|
|
179
|
+
const projects = this.projectService.search();
|
|
180
|
+
for (const project of projects) {
|
|
181
|
+
const container = await this.dockerService.getContainer(project.containerName);
|
|
182
|
+
if (!container) {
|
|
183
|
+
if (all) {
|
|
184
|
+
table.push([project.name, project.type, project.path, "-"]);
|
|
185
|
+
}
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
const { State: { Status = "stopped" } = {} } = await container.inspect();
|
|
189
|
+
table.push([project.name, project.type, project.path, Status]);
|
|
190
|
+
}
|
|
191
|
+
return table.toString();
|
|
192
|
+
}
|
|
193
|
+
async buildArgsList(name, service) {
|
|
194
|
+
const project = this.projectService.get(name);
|
|
195
|
+
const table = new cli_table3_1.default({
|
|
196
|
+
head: ["KEY", "VALUE"]
|
|
197
|
+
});
|
|
198
|
+
for (const key in project.buildArgs) {
|
|
199
|
+
table.push([
|
|
200
|
+
key,
|
|
201
|
+
typeof project.buildArgs[key] === "string"
|
|
202
|
+
? project.buildArgs[key]
|
|
203
|
+
: JSON.stringify(project.buildArgs[key])
|
|
204
|
+
]);
|
|
205
|
+
}
|
|
206
|
+
for (const serviceName in project.services) {
|
|
207
|
+
if (service && service !== serviceName) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (!project.services[serviceName].buildArgs) {
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
for (const key in project.services[serviceName].buildArgs) {
|
|
214
|
+
table.options.head = ["KEY", "VALUE", "SERVICE"];
|
|
215
|
+
table.push([
|
|
216
|
+
key,
|
|
217
|
+
project.services[serviceName].buildArgs[key],
|
|
218
|
+
serviceName
|
|
219
|
+
]);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (table.length === 0) {
|
|
223
|
+
return yoctocolors_cjs_1.default.gray("No build args found!");
|
|
224
|
+
}
|
|
225
|
+
return table.toString();
|
|
226
|
+
}
|
|
227
|
+
async buildArgsGet(args, name) {
|
|
228
|
+
const project = this.projectService.get(name);
|
|
229
|
+
const table = new cli_table3_1.default({
|
|
230
|
+
head: ["KEY", "VALUE"]
|
|
231
|
+
});
|
|
232
|
+
for (const key of args) {
|
|
233
|
+
if (project.buildArgs && typeof project.buildArgs[key] !== "undefined") {
|
|
234
|
+
const value = project.buildArgs[key] || "";
|
|
235
|
+
table.push([key, value]);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return table.toString();
|
|
239
|
+
}
|
|
240
|
+
async buildArgsSet(args, name, service) {
|
|
241
|
+
const project = this.projectService.get(name);
|
|
242
|
+
const buildArgs = args.reduce((env, config) => {
|
|
243
|
+
let [, key = "", value = ""] = config.split(/^([^=]+)=(.*)$/);
|
|
244
|
+
key = key.trim();
|
|
245
|
+
value = value.trim();
|
|
246
|
+
if (key) {
|
|
247
|
+
env[key] = value;
|
|
248
|
+
}
|
|
249
|
+
return env;
|
|
250
|
+
}, {});
|
|
251
|
+
for (const key in buildArgs) {
|
|
252
|
+
project.setBuildArg(key, buildArgs[key], service);
|
|
253
|
+
}
|
|
254
|
+
project.save();
|
|
255
|
+
}
|
|
256
|
+
async buildArgsUnset(args, name, service) {
|
|
257
|
+
const project = this.projectService.get(name);
|
|
258
|
+
const buildArgs = args.reduce((env, config) => {
|
|
259
|
+
let [, key = "", value = ""] = config.split(/^([^=]+)(?:=(.*))?$/);
|
|
260
|
+
key = key.trim();
|
|
261
|
+
value = value.trim();
|
|
262
|
+
env[key] = value;
|
|
263
|
+
return env;
|
|
264
|
+
}, {});
|
|
265
|
+
for (const key in buildArgs) {
|
|
266
|
+
project.unsetBuildArg(key, service);
|
|
267
|
+
}
|
|
268
|
+
project.save();
|
|
269
|
+
}
|
|
270
|
+
async domains(name) {
|
|
271
|
+
const project = this.projectService.get(name);
|
|
272
|
+
const table = new cli_table3_1.default({
|
|
273
|
+
head: [yoctocolors_cjs_1.default.yellow("Domain")]
|
|
274
|
+
});
|
|
275
|
+
for (const domain of project.domains) {
|
|
276
|
+
table.push([domain]);
|
|
277
|
+
}
|
|
278
|
+
return table.toString();
|
|
279
|
+
}
|
|
280
|
+
async addDomain(addDomains, name) {
|
|
281
|
+
const project = this.projectService.get(name);
|
|
282
|
+
for (const domain of addDomains) {
|
|
283
|
+
project.addDomain(domain);
|
|
284
|
+
}
|
|
285
|
+
project.save();
|
|
286
|
+
}
|
|
287
|
+
async setDomains(domains, name) {
|
|
288
|
+
const project = this.projectService.get(name);
|
|
289
|
+
project.clearDomains();
|
|
290
|
+
for (const domain of domains) {
|
|
291
|
+
project.addDomain(domain);
|
|
292
|
+
}
|
|
293
|
+
project.save();
|
|
294
|
+
}
|
|
295
|
+
async removeDomain(removeDomains, name) {
|
|
296
|
+
const project = this.projectService.get(name);
|
|
297
|
+
for (const domain of removeDomains) {
|
|
298
|
+
project.removeDomain(domain);
|
|
299
|
+
}
|
|
300
|
+
project.save();
|
|
301
|
+
}
|
|
302
|
+
async clearDomain(name) {
|
|
303
|
+
const project = this.projectService.get(name);
|
|
304
|
+
project.clearDomains();
|
|
305
|
+
project.save();
|
|
306
|
+
}
|
|
307
|
+
async ports(name, service) {
|
|
308
|
+
const project = this.projectService.get(name);
|
|
309
|
+
const table = new cli_table3_1.default({
|
|
310
|
+
head: ["Ports"]
|
|
311
|
+
});
|
|
312
|
+
for (const port of project.ports || []) {
|
|
313
|
+
table.push([port]);
|
|
314
|
+
}
|
|
315
|
+
return table.toString();
|
|
316
|
+
}
|
|
317
|
+
async addPort(hostPort, containerPort, name) {
|
|
318
|
+
const project = this.projectService.get(name);
|
|
319
|
+
project.linkPort(parseInt(hostPort), parseInt(containerPort));
|
|
320
|
+
project.save();
|
|
321
|
+
}
|
|
322
|
+
async removePort(hostPort, containerPort, name) {
|
|
323
|
+
const project = this.projectService.get(name);
|
|
324
|
+
project.unlinkPort(parseInt(hostPort), parseInt(containerPort));
|
|
325
|
+
project.save();
|
|
326
|
+
}
|
|
327
|
+
async clearPorts(name) {
|
|
328
|
+
const project = this.projectService.get(name);
|
|
329
|
+
if (project.ports) {
|
|
330
|
+
delete project.ports;
|
|
331
|
+
project.save();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
async configList(name, global, service) {
|
|
335
|
+
const table = new cli_table3_1.default({
|
|
336
|
+
head: ["KEY", "VALUE"]
|
|
337
|
+
});
|
|
338
|
+
if (global) {
|
|
339
|
+
for (const i in this.appConfigService.config.env) {
|
|
340
|
+
table.push([
|
|
341
|
+
i,
|
|
342
|
+
this.appConfigService.config.env[i]
|
|
343
|
+
]);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
const project = this.projectService.get(name);
|
|
348
|
+
for (const key in project.env) {
|
|
349
|
+
table.push([
|
|
350
|
+
key,
|
|
351
|
+
project.env[key]
|
|
352
|
+
]);
|
|
353
|
+
}
|
|
354
|
+
for (const serviceName in project.services) {
|
|
355
|
+
if (service && service !== serviceName) {
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
if (!project.services[serviceName].env) {
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
for (const key in project.services[serviceName].env) {
|
|
362
|
+
table.options.head = ["KEY", "NAME", "SERVICE"];
|
|
363
|
+
table.push([
|
|
364
|
+
key,
|
|
365
|
+
project.services[serviceName].env[key],
|
|
366
|
+
serviceName
|
|
367
|
+
]);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if (table.length === 0) {
|
|
372
|
+
return yoctocolors_cjs_1.default.gray("No environment variables found.");
|
|
373
|
+
}
|
|
374
|
+
return table.toString();
|
|
375
|
+
}
|
|
376
|
+
async configGet(keys, name, global) {
|
|
377
|
+
let config = global
|
|
378
|
+
? this.appConfigService.config
|
|
379
|
+
: this.projectService.get(name);
|
|
380
|
+
const table = new cli_table3_1.default({
|
|
381
|
+
head: ["KEY", "VALUE"]
|
|
382
|
+
});
|
|
383
|
+
for (const key of keys) {
|
|
384
|
+
const value = config.getEnv(key, "");
|
|
385
|
+
if (!value) {
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
table.push([key, value]);
|
|
389
|
+
}
|
|
390
|
+
return table.toString();
|
|
391
|
+
}
|
|
392
|
+
async configSet(variables, global, name, service) {
|
|
393
|
+
if (global) {
|
|
394
|
+
for (const variable of variables) {
|
|
395
|
+
const [key, value] = variable.split("=");
|
|
396
|
+
if (!value) {
|
|
397
|
+
console.info(yoctocolors_cjs_1.default.yellow(`No value for "${key}"`));
|
|
398
|
+
continue;
|
|
399
|
+
}
|
|
400
|
+
this.appConfigService.setEnv(key.trim(), value.trim());
|
|
401
|
+
}
|
|
402
|
+
this.appConfigService.save();
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
const project = this.projectService.get(name);
|
|
406
|
+
for (const variable of variables) {
|
|
407
|
+
const [key, value] = variable.split("=");
|
|
408
|
+
if (!value) {
|
|
409
|
+
console.info(yoctocolors_cjs_1.default.yellow(`No value for "${key}"`));
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
project.setEnv(key, value, service);
|
|
413
|
+
}
|
|
414
|
+
project.save();
|
|
415
|
+
}
|
|
416
|
+
async configUnset(configs, global, name, service) {
|
|
417
|
+
const env = configs.reduce((env, config) => {
|
|
418
|
+
const [key] = config.split("=");
|
|
419
|
+
env[key.trim()] = null;
|
|
420
|
+
return env;
|
|
421
|
+
}, {});
|
|
422
|
+
if (global) {
|
|
423
|
+
for (const i in env) {
|
|
424
|
+
this.appConfigService.unsetEnv(i);
|
|
425
|
+
}
|
|
426
|
+
this.appConfigService.save();
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
const project = this.projectService.get(name);
|
|
430
|
+
for (const i in env) {
|
|
431
|
+
project.unsetEnv(i, service);
|
|
432
|
+
}
|
|
433
|
+
project.save();
|
|
434
|
+
}
|
|
435
|
+
async volumeList(name) {
|
|
436
|
+
const project = this.projectService.get(name);
|
|
437
|
+
const table = new cli_table3_1.default({
|
|
438
|
+
head: ["Volume"]
|
|
439
|
+
});
|
|
440
|
+
const volumes = project.volumes || [];
|
|
441
|
+
for (const volume of volumes) {
|
|
442
|
+
table.push([volume]);
|
|
443
|
+
}
|
|
444
|
+
return table.toString();
|
|
445
|
+
}
|
|
446
|
+
async volumeMount(volumes, name) {
|
|
447
|
+
const project = this.projectService.get(name);
|
|
448
|
+
if (Array.isArray(volumes) && volumes.length > 0) {
|
|
449
|
+
project.volumeMount(...volumes);
|
|
450
|
+
project.save();
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
async volumeUnmount(volumes, name) {
|
|
454
|
+
const project = this.projectService.get(name);
|
|
455
|
+
if (Array.isArray(volumes) && volumes.length > 0) {
|
|
456
|
+
project.volumeUnmount(...volumes);
|
|
457
|
+
project.save();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
async extraHostList(name) {
|
|
461
|
+
const project = this.projectService.get(name);
|
|
462
|
+
if (!project.extraHosts) {
|
|
463
|
+
return "No extra hosts found";
|
|
464
|
+
}
|
|
465
|
+
const table = new cli_table3_1.default({
|
|
466
|
+
head: ["Host", "Domain"]
|
|
467
|
+
});
|
|
468
|
+
for (const host in project.extraHosts) {
|
|
469
|
+
table.push([
|
|
470
|
+
host, project.extraHosts[host]
|
|
471
|
+
]);
|
|
472
|
+
}
|
|
473
|
+
return table.toString();
|
|
474
|
+
}
|
|
475
|
+
async addExtraHost(extraHost, extraDomain, name) {
|
|
476
|
+
const project = this.projectService.get(name);
|
|
477
|
+
project.addExtraHost(extraHost, extraDomain);
|
|
478
|
+
project.save();
|
|
479
|
+
}
|
|
480
|
+
async removeExtraHost(extraHost, name) {
|
|
481
|
+
const project = this.projectService.get(name);
|
|
482
|
+
project.removeExtraHost(extraHost);
|
|
483
|
+
project.save();
|
|
484
|
+
}
|
|
39
485
|
async eject(name) {
|
|
40
486
|
const project = this.projectService.get(name);
|
|
41
487
|
const preset = this.presetService.get(project.preset);
|
|
@@ -82,12 +528,111 @@ let ProjectController = class ProjectController {
|
|
|
82
528
|
delete project.imageName;
|
|
83
529
|
project.save();
|
|
84
530
|
}
|
|
531
|
+
async attach(name) {
|
|
532
|
+
const project = this.projectService.get(name);
|
|
533
|
+
await this.projectService.attach(project);
|
|
534
|
+
}
|
|
535
|
+
async run(script, args, name, service) {
|
|
536
|
+
const project = this.projectService.get(name);
|
|
537
|
+
await this.projectService.run(project, script, service, args);
|
|
538
|
+
}
|
|
85
539
|
async exec(command, name) {
|
|
86
540
|
const project = this.projectService.get(name);
|
|
87
541
|
await this.projectService.exec(project, command);
|
|
88
542
|
}
|
|
543
|
+
async logs(name, global, detach, follow, clear) {
|
|
544
|
+
if (global) {
|
|
545
|
+
if (clear) {
|
|
546
|
+
this.logService.clear();
|
|
547
|
+
}
|
|
548
|
+
const prepareLog = (str) => {
|
|
549
|
+
return str.replace(/^\[.*]\s([^:]+):\s.*$/gm, (substring, type) => {
|
|
550
|
+
switch (type) {
|
|
551
|
+
case "debug":
|
|
552
|
+
return yoctocolors_cjs_1.default.gray(substring);
|
|
553
|
+
case "log":
|
|
554
|
+
return yoctocolors_cjs_1.default.white(substring);
|
|
555
|
+
case "info":
|
|
556
|
+
return yoctocolors_cjs_1.default.green(substring);
|
|
557
|
+
case "warn":
|
|
558
|
+
case "warning":
|
|
559
|
+
return yoctocolors_cjs_1.default.yellow(substring);
|
|
560
|
+
case "error":
|
|
561
|
+
return yoctocolors_cjs_1.default.red(substring);
|
|
562
|
+
default:
|
|
563
|
+
return substring;
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
};
|
|
567
|
+
const file = this.fs.open("ws.log", "r");
|
|
568
|
+
const stream = file.createReadlineStream({
|
|
569
|
+
start: -10
|
|
570
|
+
});
|
|
571
|
+
stream.on("data", (line) => {
|
|
572
|
+
process.stdout.write(prepareLog(line));
|
|
573
|
+
process.stdout.write("\n");
|
|
574
|
+
});
|
|
575
|
+
if (follow) {
|
|
576
|
+
const stats = file.stat();
|
|
577
|
+
const watcher = this.fs.watch("ws.log");
|
|
578
|
+
const mutex = new async_mutex_1.Mutex();
|
|
579
|
+
let position = stats.size;
|
|
580
|
+
watcher.on("change", async () => {
|
|
581
|
+
await mutex.acquire();
|
|
582
|
+
try {
|
|
583
|
+
const stats = file.stat();
|
|
584
|
+
if (stats.size < position) {
|
|
585
|
+
console.info("file truncated");
|
|
586
|
+
position = 0;
|
|
587
|
+
}
|
|
588
|
+
const buffer = file.readBytes(position);
|
|
589
|
+
position += buffer.length;
|
|
590
|
+
process.stdout.write(prepareLog(buffer.toString("utf-8")));
|
|
591
|
+
}
|
|
592
|
+
finally {
|
|
593
|
+
mutex.release();
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
const project = this.projectService.get(name);
|
|
600
|
+
await this.projectService.logs(project, detach);
|
|
601
|
+
}
|
|
89
602
|
};
|
|
90
603
|
exports.ProjectController = ProjectController;
|
|
604
|
+
__decorate([
|
|
605
|
+
(0, core_1.Completion)("name"),
|
|
606
|
+
__metadata("design:type", Function),
|
|
607
|
+
__metadata("design:paramtypes", []),
|
|
608
|
+
__metadata("design:returntype", Promise)
|
|
609
|
+
], ProjectController.prototype, "getProjectNames", null);
|
|
610
|
+
__decorate([
|
|
611
|
+
(0, core_1.Completion)("script"),
|
|
612
|
+
__metadata("design:type", Function),
|
|
613
|
+
__metadata("design:paramtypes", []),
|
|
614
|
+
__metadata("design:returntype", Promise)
|
|
615
|
+
], ProjectController.prototype, "getScriptNames", null);
|
|
616
|
+
__decorate([
|
|
617
|
+
(0, core_1.Command)("init"),
|
|
618
|
+
(0, core_1.Description)("Project initialisation"),
|
|
619
|
+
__param(0, (0, core_1.Option)("name", "n")),
|
|
620
|
+
__param(0, (0, core_1.Description)("The name of the project")),
|
|
621
|
+
__param(1, (0, core_1.Option)("type", "t")),
|
|
622
|
+
__param(1, (0, core_1.Description)("The type of the project")),
|
|
623
|
+
__metadata("design:type", Function),
|
|
624
|
+
__metadata("design:paramtypes", [String, String]),
|
|
625
|
+
__metadata("design:returntype", Promise)
|
|
626
|
+
], ProjectController.prototype, "init", null);
|
|
627
|
+
__decorate([
|
|
628
|
+
(0, core_1.Command)("destroy [name]"),
|
|
629
|
+
(0, core_1.Description)("Permanently destroy a project"),
|
|
630
|
+
__param(0, (0, core_1.Option)("name", "n")),
|
|
631
|
+
__param(0, (0, core_1.Description)("The name of the project")),
|
|
632
|
+
__metadata("design:type", Function),
|
|
633
|
+
__metadata("design:paramtypes", [String]),
|
|
634
|
+
__metadata("design:returntype", Promise)
|
|
635
|
+
], ProjectController.prototype, "destroy", null);
|
|
91
636
|
__decorate([
|
|
92
637
|
(0, core_1.Command)("start"),
|
|
93
638
|
(0, core_1.Description)("Starting project"),
|
|
@@ -112,6 +657,252 @@ __decorate([
|
|
|
112
657
|
__metadata("design:paramtypes", [String]),
|
|
113
658
|
__metadata("design:returntype", Promise)
|
|
114
659
|
], ProjectController.prototype, "stop", null);
|
|
660
|
+
__decorate([
|
|
661
|
+
(0, core_1.Command)("ps"),
|
|
662
|
+
(0, core_1.Description)("Projects list"),
|
|
663
|
+
__param(0, (0, core_1.Option)("all", "a")),
|
|
664
|
+
__param(0, (0, core_1.Description)("All projects")),
|
|
665
|
+
__metadata("design:type", Function),
|
|
666
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
667
|
+
__metadata("design:returntype", Promise)
|
|
668
|
+
], ProjectController.prototype, "projectList", null);
|
|
669
|
+
__decorate([
|
|
670
|
+
(0, core_1.Command)("build-args"),
|
|
671
|
+
(0, core_1.Description)("Show build args of the project"),
|
|
672
|
+
__param(0, (0, core_1.Option)("name", "n")),
|
|
673
|
+
__param(0, (0, core_1.Description)("The name of the project")),
|
|
674
|
+
__param(1, (0, core_1.Option)("service", "s")),
|
|
675
|
+
__param(1, (0, core_1.Description)("The name of the service")),
|
|
676
|
+
__metadata("design:type", Function),
|
|
677
|
+
__metadata("design:paramtypes", [String, String]),
|
|
678
|
+
__metadata("design:returntype", Promise)
|
|
679
|
+
], ProjectController.prototype, "buildArgsList", null);
|
|
680
|
+
__decorate([
|
|
681
|
+
(0, core_1.Command)("build-args:get [...buildArgs]"),
|
|
682
|
+
__param(0, (0, core_1.Param)("buildArgs")),
|
|
683
|
+
__param(1, (0, core_1.Option)("name", "n")),
|
|
684
|
+
__param(1, (0, core_1.Description)("The name of the project")),
|
|
685
|
+
__metadata("design:type", Function),
|
|
686
|
+
__metadata("design:paramtypes", [Array, String]),
|
|
687
|
+
__metadata("design:returntype", Promise)
|
|
688
|
+
], ProjectController.prototype, "buildArgsGet", null);
|
|
689
|
+
__decorate([
|
|
690
|
+
(0, core_1.Command)("build-args:set [...buildArgs]"),
|
|
691
|
+
(0, core_1.Description)("Set build args for the project"),
|
|
692
|
+
__param(0, (0, core_1.Param)("buildArgs")),
|
|
693
|
+
__param(1, (0, core_1.Option)("name", "n")),
|
|
694
|
+
__param(1, (0, core_1.Description)("The name of the project")),
|
|
695
|
+
__param(2, (0, core_1.Option)("service", "s")),
|
|
696
|
+
__param(2, (0, core_1.Description)("The name of the service")),
|
|
697
|
+
__metadata("design:type", Function),
|
|
698
|
+
__metadata("design:paramtypes", [Array, String, String]),
|
|
699
|
+
__metadata("design:returntype", Promise)
|
|
700
|
+
], ProjectController.prototype, "buildArgsSet", null);
|
|
701
|
+
__decorate([
|
|
702
|
+
(0, core_1.Command)("build-args:unset [...buildArgs]"),
|
|
703
|
+
(0, core_1.Description)("Remove build args for the project"),
|
|
704
|
+
__param(0, (0, core_1.Param)("buildArgs")),
|
|
705
|
+
__param(1, (0, core_1.Option)("name", "n")),
|
|
706
|
+
__param(1, (0, core_1.Description)("The name of the project")),
|
|
707
|
+
__param(2, (0, core_1.Option)("service", "s")),
|
|
708
|
+
__param(2, (0, core_1.Description)("The name of the service")),
|
|
709
|
+
__metadata("design:type", Function),
|
|
710
|
+
__metadata("design:paramtypes", [Array, String, String]),
|
|
711
|
+
__metadata("design:returntype", Promise)
|
|
712
|
+
], ProjectController.prototype, "buildArgsUnset", null);
|
|
713
|
+
__decorate([
|
|
714
|
+
(0, core_1.Command)("domains"),
|
|
715
|
+
(0, core_1.Description)("Project domain list"),
|
|
716
|
+
__param(0, (0, core_1.Option)("name", "n")),
|
|
717
|
+
__param(0, (0, core_1.Description)("The name of the project")),
|
|
718
|
+
__metadata("design:type", Function),
|
|
719
|
+
__metadata("design:paramtypes", [String]),
|
|
720
|
+
__metadata("design:returntype", Promise)
|
|
721
|
+
], ProjectController.prototype, "domains", null);
|
|
722
|
+
__decorate([
|
|
723
|
+
(0, core_1.Command)("domain:add [...domains]"),
|
|
724
|
+
(0, core_1.Description)("Adding project domain"),
|
|
725
|
+
__param(0, (0, core_1.Param)("domains")),
|
|
726
|
+
__param(1, (0, core_1.Option)("name", "n")),
|
|
727
|
+
__param(1, (0, core_1.Description)("The name of the project")),
|
|
728
|
+
__metadata("design:type", Function),
|
|
729
|
+
__metadata("design:paramtypes", [Array, String]),
|
|
730
|
+
__metadata("design:returntype", Promise)
|
|
731
|
+
], ProjectController.prototype, "addDomain", null);
|
|
732
|
+
__decorate([
|
|
733
|
+
(0, core_1.Command)("domain:set [...domains]"),
|
|
734
|
+
(0, core_1.Description)("Setting project domains"),
|
|
735
|
+
__param(0, (0, core_1.Param)("domains")),
|
|
736
|
+
__param(1, (0, core_1.Option)("name", "n")),
|
|
737
|
+
__param(1, (0, core_1.Description)("The name of the project")),
|
|
738
|
+
__metadata("design:type", Function),
|
|
739
|
+
__metadata("design:paramtypes", [Array, String]),
|
|
740
|
+
__metadata("design:returntype", Promise)
|
|
741
|
+
], ProjectController.prototype, "setDomains", null);
|
|
742
|
+
__decorate([
|
|
743
|
+
(0, core_1.Command)("domain:remove [...domains]"),
|
|
744
|
+
(0, core_1.Description)("Removing project domain"),
|
|
745
|
+
__param(0, (0, core_1.Param)("domains")),
|
|
746
|
+
__param(1, (0, core_1.Option)("name", "n")),
|
|
747
|
+
__param(1, (0, core_1.Description)("The name of the project")),
|
|
748
|
+
__metadata("design:type", Function),
|
|
749
|
+
__metadata("design:paramtypes", [Array, String]),
|
|
750
|
+
__metadata("design:returntype", Promise)
|
|
751
|
+
], ProjectController.prototype, "removeDomain", null);
|
|
752
|
+
__decorate([
|
|
753
|
+
(0, core_1.Command)("domain:clear"),
|
|
754
|
+
(0, core_1.Description)("Clearing project domain"),
|
|
755
|
+
__param(0, (0, core_1.Option)("name", "n")),
|
|
756
|
+
__param(0, (0, core_1.Description)("The name of the project")),
|
|
757
|
+
__metadata("design:type", Function),
|
|
758
|
+
__metadata("design:paramtypes", [String]),
|
|
759
|
+
__metadata("design:returntype", Promise)
|
|
760
|
+
], ProjectController.prototype, "clearDomain", null);
|
|
761
|
+
__decorate([
|
|
762
|
+
(0, core_1.Command)("ports"),
|
|
763
|
+
__param(0, (0, core_1.Option)("name", "n")),
|
|
764
|
+
__param(0, (0, core_1.Description)("The name of the project")),
|
|
765
|
+
__param(1, (0, core_1.Option)("service", "s")),
|
|
766
|
+
__metadata("design:type", Function),
|
|
767
|
+
__metadata("design:paramtypes", [String, String]),
|
|
768
|
+
__metadata("design:returntype", Promise)
|
|
769
|
+
], ProjectController.prototype, "ports", null);
|
|
770
|
+
__decorate([
|
|
771
|
+
(0, core_1.Command)("port:add <host-port>:<container-port>"),
|
|
772
|
+
__param(0, (0, core_1.Param)("host-port")),
|
|
773
|
+
__param(1, (0, core_1.Param)("container-port")),
|
|
774
|
+
__param(2, (0, core_1.Option)("name", {
|
|
775
|
+
type: "string",
|
|
776
|
+
alias: "n",
|
|
777
|
+
description: "The name of the project"
|
|
778
|
+
})),
|
|
779
|
+
__metadata("design:type", Function),
|
|
780
|
+
__metadata("design:paramtypes", [String, String, String]),
|
|
781
|
+
__metadata("design:returntype", Promise)
|
|
782
|
+
], ProjectController.prototype, "addPort", null);
|
|
783
|
+
__decorate([
|
|
784
|
+
(0, core_1.Command)("port:remove <host-port>:<container-port>"),
|
|
785
|
+
__param(0, (0, core_1.Param)("host-port")),
|
|
786
|
+
__param(1, (0, core_1.Param)("container-port")),
|
|
787
|
+
__param(2, (0, core_1.Option)("name", {
|
|
788
|
+
type: "string",
|
|
789
|
+
alias: "n",
|
|
790
|
+
description: "The name of the project"
|
|
791
|
+
})),
|
|
792
|
+
__metadata("design:type", Function),
|
|
793
|
+
__metadata("design:paramtypes", [String, String, String]),
|
|
794
|
+
__metadata("design:returntype", Promise)
|
|
795
|
+
], ProjectController.prototype, "removePort", null);
|
|
796
|
+
__decorate([
|
|
797
|
+
(0, core_1.Command)("port:clear"),
|
|
798
|
+
__param(0, (0, core_1.Option)("name", "n")),
|
|
799
|
+
__param(0, (0, core_1.Description)("The name of the project")),
|
|
800
|
+
__metadata("design:type", Function),
|
|
801
|
+
__metadata("design:paramtypes", [String]),
|
|
802
|
+
__metadata("design:returntype", Promise)
|
|
803
|
+
], ProjectController.prototype, "clearPorts", null);
|
|
804
|
+
__decorate([
|
|
805
|
+
(0, core_1.Command)("config"),
|
|
806
|
+
__param(0, (0, core_1.Option)("name", "n")),
|
|
807
|
+
__param(0, (0, core_1.Description)("The name of the project")),
|
|
808
|
+
__param(1, (0, core_1.Option)("global", "g")),
|
|
809
|
+
__param(2, (0, core_1.Option)("service", "s")),
|
|
810
|
+
__param(2, (0, core_1.Description)("The name of the service")),
|
|
811
|
+
__metadata("design:type", Function),
|
|
812
|
+
__metadata("design:paramtypes", [String, Boolean, String]),
|
|
813
|
+
__metadata("design:returntype", Promise)
|
|
814
|
+
], ProjectController.prototype, "configList", null);
|
|
815
|
+
__decorate([
|
|
816
|
+
(0, core_1.Command)("config:get [...key]"),
|
|
817
|
+
__param(0, (0, core_1.Param)("key")),
|
|
818
|
+
__param(1, (0, core_1.Option)("name", "n")),
|
|
819
|
+
__param(1, (0, core_1.Description)("The name of the project")),
|
|
820
|
+
__param(2, (0, core_1.Option)("global", "g")),
|
|
821
|
+
__metadata("design:type", Function),
|
|
822
|
+
__metadata("design:paramtypes", [Array, String, Boolean]),
|
|
823
|
+
__metadata("design:returntype", Promise)
|
|
824
|
+
], ProjectController.prototype, "configGet", null);
|
|
825
|
+
__decorate([
|
|
826
|
+
(0, core_1.Command)("config:set [...configs]"),
|
|
827
|
+
(0, core_1.Description)("Setting env variables"),
|
|
828
|
+
__param(0, (0, core_1.Param)("configs")),
|
|
829
|
+
__param(1, (0, core_1.Option)("global", "g")),
|
|
830
|
+
__param(2, (0, core_1.Option)("name", "n")),
|
|
831
|
+
__param(2, (0, core_1.Description)("The name of the project")),
|
|
832
|
+
__param(3, (0, core_1.Option)("service", "s")),
|
|
833
|
+
__param(3, (0, core_1.Description)("The name of the service")),
|
|
834
|
+
__metadata("design:type", Function),
|
|
835
|
+
__metadata("design:paramtypes", [Array, Boolean, String, String]),
|
|
836
|
+
__metadata("design:returntype", Promise)
|
|
837
|
+
], ProjectController.prototype, "configSet", null);
|
|
838
|
+
__decorate([
|
|
839
|
+
(0, core_1.Command)("config:unset [...configs]"),
|
|
840
|
+
__param(0, (0, core_1.Param)("configs")),
|
|
841
|
+
__param(1, (0, core_1.Option)("global", "g")),
|
|
842
|
+
__param(2, (0, core_1.Option)("name", "n")),
|
|
843
|
+
__param(2, (0, core_1.Description)("The name of the project")),
|
|
844
|
+
__param(3, (0, core_1.Option)("service", "s")),
|
|
845
|
+
__param(3, (0, core_1.Description)("The name of the service")),
|
|
846
|
+
__metadata("design:type", Function),
|
|
847
|
+
__metadata("design:paramtypes", [Array, Boolean, String, String]),
|
|
848
|
+
__metadata("design:returntype", Promise)
|
|
849
|
+
], ProjectController.prototype, "configUnset", null);
|
|
850
|
+
__decorate([
|
|
851
|
+
(0, core_1.Command)("volumes"),
|
|
852
|
+
__param(0, (0, core_1.Option)("name", "n")),
|
|
853
|
+
__param(0, (0, core_1.Description)("The name of the project")),
|
|
854
|
+
__metadata("design:type", Function),
|
|
855
|
+
__metadata("design:paramtypes", [String]),
|
|
856
|
+
__metadata("design:returntype", Promise)
|
|
857
|
+
], ProjectController.prototype, "volumeList", null);
|
|
858
|
+
__decorate([
|
|
859
|
+
(0, core_1.Command)("volume:mount [...volumes]"),
|
|
860
|
+
__param(0, (0, core_1.Param)("volumes")),
|
|
861
|
+
__param(1, (0, core_1.Option)("name", "n")),
|
|
862
|
+
__param(1, (0, core_1.Description)("The name of the project")),
|
|
863
|
+
__metadata("design:type", Function),
|
|
864
|
+
__metadata("design:paramtypes", [Array, String]),
|
|
865
|
+
__metadata("design:returntype", Promise)
|
|
866
|
+
], ProjectController.prototype, "volumeMount", null);
|
|
867
|
+
__decorate([
|
|
868
|
+
(0, core_1.Command)("volume:unmount [...volumes]"),
|
|
869
|
+
__param(0, (0, core_1.Param)("volumes")),
|
|
870
|
+
__param(1, (0, core_1.Option)("name", "n")),
|
|
871
|
+
__param(1, (0, core_1.Description)("The name of the project")),
|
|
872
|
+
__metadata("design:type", Function),
|
|
873
|
+
__metadata("design:paramtypes", [Array, String]),
|
|
874
|
+
__metadata("design:returntype", Promise)
|
|
875
|
+
], ProjectController.prototype, "volumeUnmount", null);
|
|
876
|
+
__decorate([
|
|
877
|
+
(0, core_1.Command)("extra-hosts"),
|
|
878
|
+
(0, core_1.Description)("List of extra hosts"),
|
|
879
|
+
__param(0, (0, core_1.Option)("name", "n")),
|
|
880
|
+
__param(0, (0, core_1.Description)("The name of the project")),
|
|
881
|
+
__metadata("design:type", Function),
|
|
882
|
+
__metadata("design:paramtypes", [String]),
|
|
883
|
+
__metadata("design:returntype", Promise)
|
|
884
|
+
], ProjectController.prototype, "extraHostList", null);
|
|
885
|
+
__decorate([
|
|
886
|
+
(0, core_1.Command)("extra-host:add <extraHost>:<extraDomain>"),
|
|
887
|
+
(0, core_1.Description)("Adding extra host"),
|
|
888
|
+
__param(0, (0, core_1.Param)("extraHost")),
|
|
889
|
+
__param(1, (0, core_1.Param)("extraDomain")),
|
|
890
|
+
__param(2, (0, core_1.Option)("name", "n")),
|
|
891
|
+
__param(2, (0, core_1.Description)("The name of the project")),
|
|
892
|
+
__metadata("design:type", Function),
|
|
893
|
+
__metadata("design:paramtypes", [String, String, String]),
|
|
894
|
+
__metadata("design:returntype", Promise)
|
|
895
|
+
], ProjectController.prototype, "addExtraHost", null);
|
|
896
|
+
__decorate([
|
|
897
|
+
(0, core_1.Command)("extra-host:remove <extraHost>"),
|
|
898
|
+
(0, core_1.Description)("Removing extra host"),
|
|
899
|
+
__param(0, (0, core_1.Param)("extraHost")),
|
|
900
|
+
__param(1, (0, core_1.Option)("name", "n")),
|
|
901
|
+
__param(1, (0, core_1.Description)("The name of the project")),
|
|
902
|
+
__metadata("design:type", Function),
|
|
903
|
+
__metadata("design:paramtypes", [String, String]),
|
|
904
|
+
__metadata("design:returntype", Promise)
|
|
905
|
+
], ProjectController.prototype, "removeExtraHost", null);
|
|
115
906
|
__decorate([
|
|
116
907
|
(0, core_1.Command)("preset:eject"),
|
|
117
908
|
(0, core_1.Description)("Eject preset files into the project"),
|
|
@@ -121,23 +912,62 @@ __decorate([
|
|
|
121
912
|
__metadata("design:paramtypes", [String]),
|
|
122
913
|
__metadata("design:returntype", Promise)
|
|
123
914
|
], ProjectController.prototype, "eject", null);
|
|
915
|
+
__decorate([
|
|
916
|
+
(0, core_1.Command)("attach"),
|
|
917
|
+
(0, core_1.Description)("Attach local standard input, output, and error streams to a running container"),
|
|
918
|
+
__param(0, (0, core_1.Option)("name", "n")),
|
|
919
|
+
__param(0, (0, core_1.Description)("The name of the project")),
|
|
920
|
+
__metadata("design:type", Function),
|
|
921
|
+
__metadata("design:paramtypes", [String]),
|
|
922
|
+
__metadata("design:returntype", Promise)
|
|
923
|
+
], ProjectController.prototype, "attach", null);
|
|
924
|
+
__decorate([
|
|
925
|
+
(0, core_1.Command)("run <script> [...args]"),
|
|
926
|
+
__param(0, (0, core_1.Param)("script")),
|
|
927
|
+
__param(1, (0, core_1.Param)("args")),
|
|
928
|
+
__param(2, (0, core_1.Option)("name", "n")),
|
|
929
|
+
__param(2, (0, core_1.Description)("The name of the project")),
|
|
930
|
+
__param(3, (0, core_1.Option)("service", "s")),
|
|
931
|
+
__param(3, (0, core_1.Description)("The name of the service")),
|
|
932
|
+
__metadata("design:type", Function),
|
|
933
|
+
__metadata("design:paramtypes", [String, Array, String, String]),
|
|
934
|
+
__metadata("design:returntype", Promise)
|
|
935
|
+
], ProjectController.prototype, "run", null);
|
|
124
936
|
__decorate([
|
|
125
937
|
(0, core_1.Command)("exec [...command]"),
|
|
126
938
|
__param(0, (0, core_1.Param)("command")),
|
|
127
|
-
__param(1, (0, core_1.Option)("name",
|
|
128
|
-
|
|
129
|
-
alias: "n",
|
|
130
|
-
description: "The name of the project"
|
|
131
|
-
})),
|
|
939
|
+
__param(1, (0, core_1.Option)("name", "n")),
|
|
940
|
+
__param(1, (0, core_1.Description)("The name of the project")),
|
|
132
941
|
__metadata("design:type", Function),
|
|
133
942
|
__metadata("design:paramtypes", [Array, String]),
|
|
134
943
|
__metadata("design:returntype", Promise)
|
|
135
944
|
], ProjectController.prototype, "exec", null);
|
|
945
|
+
__decorate([
|
|
946
|
+
(0, core_1.Command)("logs"),
|
|
947
|
+
(0, core_1.Description)("Logs"),
|
|
948
|
+
__param(0, (0, core_1.Option)("name", "n")),
|
|
949
|
+
__param(0, (0, core_1.Description)("The name of the project")),
|
|
950
|
+
__param(1, (0, core_1.Option)("global", "g")),
|
|
951
|
+
__param(1, (0, core_1.Description)("Global")),
|
|
952
|
+
__param(2, (0, core_1.Option)("detach", "d")),
|
|
953
|
+
__param(2, (0, core_1.Description)("Detach")),
|
|
954
|
+
__param(3, (0, core_1.Option)("follow", "f")),
|
|
955
|
+
__param(3, (0, core_1.Description)("Follow")),
|
|
956
|
+
__param(4, (0, core_1.Option)("clear", "c")),
|
|
957
|
+
__param(4, (0, core_1.Description)("Clear log file (works only with --global)")),
|
|
958
|
+
__metadata("design:type", Function),
|
|
959
|
+
__metadata("design:paramtypes", [String, Boolean, Boolean, Boolean, Boolean]),
|
|
960
|
+
__metadata("design:returntype", Promise)
|
|
961
|
+
], ProjectController.prototype, "logs", null);
|
|
136
962
|
exports.ProjectController = ProjectController = __decorate([
|
|
137
963
|
(0, core_1.Controller)(),
|
|
138
964
|
(0, core_1.Description)("Project commands"),
|
|
139
965
|
__metadata("design:paramtypes", [core_1.AppConfigService,
|
|
966
|
+
core_1.AppFileSystemService,
|
|
140
967
|
core_1.ProcessService,
|
|
141
968
|
ProjectService_1.ProjectService,
|
|
142
|
-
preset_1.PresetService
|
|
969
|
+
preset_1.PresetService,
|
|
970
|
+
core_1.EventService,
|
|
971
|
+
core_1.DockerService,
|
|
972
|
+
core_1.LogService])
|
|
143
973
|
], ProjectController);
|