@wocker/ws 1.0.23 → 1.0.24
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/lib/{AppModule.d.ts → RootModule.d.ts} +1 -1
- package/lib/{AppModule.js → RootModule.js} +32 -30
- package/lib/controllers/DebugController.d.ts +1 -2
- package/lib/controllers/DebugController.js +4 -6
- package/lib/controllers/ExperimentalController.d.ts +1 -1
- package/lib/controllers/ExperimentalController.js +1 -2
- package/lib/controllers/PluginController.d.ts +1 -1
- package/lib/controllers/PluginController.js +1 -2
- package/lib/controllers/ProjectController.d.ts +7 -10
- package/lib/controllers/ProjectController.js +64 -202
- package/lib/controllers/index.d.ts +0 -1
- package/lib/controllers/index.js +0 -1
- package/lib/env.d.ts +2 -2
- package/lib/env.js +3 -3
- package/lib/main.js +5 -9
- package/lib/makes/index.d.ts +0 -1
- package/lib/makes/index.js +0 -1
- package/lib/modules/app/index.js +17 -1
- package/lib/modules/docker/index.d.ts +2 -2
- package/lib/modules/docker/index.js +5 -5
- package/lib/modules/docker/services/DockerService.d.ts +2 -2
- package/lib/modules/docker/services/DockerService.js +5 -5
- package/lib/modules/docker/services/ModemService.d.ts +1 -0
- package/lib/modules/docker/services/ModemService.js +1 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +3 -0
- package/lib/modules/keystore/controllers/KeystoreController.d.ts +1 -1
- package/lib/modules/keystore/controllers/KeystoreController.js +1 -2
- package/lib/modules/keystore/providers/FileKeystoreProvider.d.ts +3 -4
- package/lib/modules/keystore/providers/FileKeystoreProvider.js +4 -5
- package/lib/modules/keystore/services/KeystoreService.d.ts +4 -3
- package/lib/modules/keystore/services/KeystoreService.js +9 -6
- package/lib/modules/preset/controllers/PresetController.d.ts +18 -0
- package/lib/modules/preset/controllers/PresetController.js +157 -0
- package/lib/modules/preset/controllers/PresetListener.d.ts +14 -0
- package/lib/modules/preset/controllers/PresetListener.js +140 -0
- package/lib/modules/preset/index.d.ts +5 -0
- package/lib/modules/preset/index.js +39 -0
- package/lib/modules/preset/repositories/PresetRepository.d.ts +16 -0
- package/lib/{repositories → modules/preset/repositories}/PresetRepository.js +9 -11
- package/lib/{services → modules/preset/services}/PresetService.d.ts +4 -12
- package/lib/{services → modules/preset/services}/PresetService.js +20 -24
- package/lib/modules/project/controllers/ProjectController.d.ts +13 -0
- package/lib/modules/project/controllers/ProjectController.js +127 -0
- package/lib/modules/project/index.d.ts +5 -0
- package/lib/modules/project/index.js +39 -0
- package/lib/modules/project/repositories/ProjectRepository.d.ts +13 -0
- package/lib/modules/project/repositories/ProjectRepository.js +90 -0
- package/lib/modules/project/services/ProjectService.d.ts +21 -0
- package/lib/modules/project/services/ProjectService.js +211 -0
- package/lib/modules/proxy/controllers/CertController.d.ts +1 -1
- package/lib/modules/proxy/controllers/CertController.js +2 -2
- package/lib/modules/proxy/controllers/ProxyController.d.ts +4 -6
- package/lib/modules/proxy/controllers/ProxyController.js +9 -11
- package/lib/modules/proxy/index.js +3 -1
- package/lib/modules/proxy/services/CertService.d.ts +3 -4
- package/lib/modules/proxy/services/CertService.js +5 -6
- package/lib/modules/proxy/services/ProxyService.d.ts +3 -3
- package/lib/modules/proxy/services/ProxyService.js +14 -15
- package/lib/services/PluginService.d.ts +1 -3
- package/lib/services/PluginService.js +9 -13
- package/package.json +5 -5
- package/lib/controllers/PresetController.d.ts +0 -27
- package/lib/controllers/PresetController.js +0 -364
- package/lib/makes/Logger.d.ts +0 -9
- package/lib/makes/Logger.js +0 -34
- package/lib/repositories/PresetRepository.d.ts +0 -23
- package/lib/repositories/index.d.ts +0 -1
- package/lib/repositories/index.js +0 -17
- package/lib/services/AppConfigService.d.ts +0 -24
- package/lib/services/AppConfigService.js +0 -154
- package/lib/services/AppEventsService.d.ts +0 -9
- package/lib/services/AppEventsService.js +0 -43
- package/lib/services/LogService.d.ts +0 -15
- package/lib/services/LogService.js +0 -67
- package/lib/services/ProjectService.d.ts +0 -27
- package/lib/services/ProjectService.js +0 -206
- package/presets/go/Dockerfile +0 -19
- package/presets/go/config.json +0 -14
- package/presets/php-fpm/Dockerfile +0 -173
- package/presets/php-fpm/bin/compare-version +0 -3
- package/presets/php-fpm/config.json +0 -55
- package/presets/php-fpm/etc/nginx/sites-available/default.conf +0 -36
|
@@ -55,22 +55,20 @@ const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
|
55
55
|
const yoctocolors_cjs_1 = __importDefault(require("yoctocolors-cjs"));
|
|
56
56
|
const Path = __importStar(require("path"));
|
|
57
57
|
const async_mutex_1 = require("async-mutex");
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const ProjectService_1 = require("../services/ProjectService");
|
|
61
|
-
const LogService_1 = require("../services/LogService");
|
|
62
|
-
const modules_1 = require("../modules");
|
|
63
|
-
const process = __importStar(require("node:process"));
|
|
58
|
+
const docker_1 = require("../modules/docker");
|
|
59
|
+
const project_1 = require("../modules/project");
|
|
64
60
|
let ProjectController = class ProjectController {
|
|
65
|
-
constructor(appConfigService,
|
|
61
|
+
constructor(appConfigService, processService, eventService, projectService, projectRepository, logService, dockerService) {
|
|
66
62
|
this.appConfigService = appConfigService;
|
|
67
|
-
this.
|
|
63
|
+
this.processService = processService;
|
|
64
|
+
this.eventService = eventService;
|
|
68
65
|
this.projectService = projectService;
|
|
66
|
+
this.projectRepository = projectRepository;
|
|
69
67
|
this.logService = logService;
|
|
70
68
|
this.dockerService = dockerService;
|
|
71
69
|
}
|
|
72
70
|
async getProjectNames() {
|
|
73
|
-
const projects = this.
|
|
71
|
+
const projects = this.projectRepository.search();
|
|
74
72
|
return projects.map((project) => {
|
|
75
73
|
return project.name;
|
|
76
74
|
});
|
|
@@ -85,12 +83,12 @@ let ProjectController = class ProjectController {
|
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
85
|
async init(name, type) {
|
|
88
|
-
const fs = new core_1.FileSystem(this.
|
|
89
|
-
let project = this.
|
|
86
|
+
const fs = new core_1.FileSystem(this.processService.pwd());
|
|
87
|
+
let project = this.projectRepository.searchOne({
|
|
90
88
|
path: fs.path()
|
|
91
89
|
});
|
|
92
90
|
if (!project) {
|
|
93
|
-
project = this.
|
|
91
|
+
project = this.projectRepository.fromObject({
|
|
94
92
|
path: fs.path()
|
|
95
93
|
});
|
|
96
94
|
}
|
|
@@ -108,7 +106,7 @@ let ProjectController = class ProjectController {
|
|
|
108
106
|
if (typeof name !== "string") {
|
|
109
107
|
return true;
|
|
110
108
|
}
|
|
111
|
-
const otherProject = this.
|
|
109
|
+
const otherProject = this.projectRepository.searchOne({
|
|
112
110
|
name
|
|
113
111
|
});
|
|
114
112
|
if (otherProject && otherProject.path !== project.path) {
|
|
@@ -163,12 +161,27 @@ let ProjectController = class ProjectController {
|
|
|
163
161
|
});
|
|
164
162
|
break;
|
|
165
163
|
}
|
|
164
|
+
case core_1.PROJECT_TYPE_COMPOSE: {
|
|
165
|
+
const composeFiles = fs.readdir().filter((file) => {
|
|
166
|
+
return /docker-compose\./.test(file);
|
|
167
|
+
});
|
|
168
|
+
if (composeFiles.length === 0) {
|
|
169
|
+
throw new Error("docker-compose files not found");
|
|
170
|
+
}
|
|
171
|
+
project.composefile = await (0, utils_1.promptSelect)({
|
|
172
|
+
message: "Docker compose",
|
|
173
|
+
required: true,
|
|
174
|
+
options: composeFiles,
|
|
175
|
+
default: project.composefile
|
|
176
|
+
});
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
166
179
|
case core_1.PROJECT_TYPE_PRESET:
|
|
167
180
|
break;
|
|
168
181
|
default:
|
|
169
182
|
throw new Error("Invalid project type");
|
|
170
183
|
}
|
|
171
|
-
await this.
|
|
184
|
+
await this.eventService.emit("project:init", project);
|
|
172
185
|
project.save();
|
|
173
186
|
}
|
|
174
187
|
async destroy(name) {
|
|
@@ -185,7 +198,7 @@ let ProjectController = class ProjectController {
|
|
|
185
198
|
head: ["Name", "Type", "Status"],
|
|
186
199
|
colAligns: ["left", "center", "center"]
|
|
187
200
|
});
|
|
188
|
-
const projects = this.
|
|
201
|
+
const projects = this.projectRepository.search();
|
|
189
202
|
for (const project of projects) {
|
|
190
203
|
const container = await this.dockerService.getContainer(project.containerName);
|
|
191
204
|
if (!container) {
|
|
@@ -199,28 +212,8 @@ let ProjectController = class ProjectController {
|
|
|
199
212
|
}
|
|
200
213
|
return table.toString();
|
|
201
214
|
}
|
|
202
|
-
async start(name, detach, attach, rebuild, restart) {
|
|
203
|
-
const project = this.projectService.get(name);
|
|
204
|
-
await this.projectService.start(project, restart, rebuild);
|
|
205
|
-
if (detach) {
|
|
206
|
-
console.info(yoctocolors_cjs_1.default.yellow("Warning: Detach option is deprecated"));
|
|
207
|
-
}
|
|
208
|
-
if (attach) {
|
|
209
|
-
await this.dockerService.attach(project.containerName);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
async stop(name) {
|
|
213
|
-
if (name) {
|
|
214
|
-
this.projectService.cdProject(name);
|
|
215
|
-
}
|
|
216
|
-
const project = this.projectService.get();
|
|
217
|
-
await this.projectService.stop(project);
|
|
218
|
-
}
|
|
219
215
|
async domains(name) {
|
|
220
|
-
|
|
221
|
-
this.projectService.cdProject(name);
|
|
222
|
-
}
|
|
223
|
-
const project = this.projectService.get();
|
|
216
|
+
const project = this.projectService.get(name);
|
|
224
217
|
const table = new cli_table3_1.default({
|
|
225
218
|
head: [yoctocolors_cjs_1.default.yellow("Domain")]
|
|
226
219
|
});
|
|
@@ -230,20 +223,14 @@ let ProjectController = class ProjectController {
|
|
|
230
223
|
return table.toString();
|
|
231
224
|
}
|
|
232
225
|
async addDomain(addDomains, name) {
|
|
233
|
-
|
|
234
|
-
this.projectService.cdProject(name);
|
|
235
|
-
}
|
|
236
|
-
const project = this.projectService.get();
|
|
226
|
+
const project = this.projectService.get(name);
|
|
237
227
|
for (const domain of addDomains) {
|
|
238
228
|
project.addDomain(domain);
|
|
239
229
|
}
|
|
240
230
|
project.save();
|
|
241
231
|
}
|
|
242
232
|
async setDomains(domains, name) {
|
|
243
|
-
|
|
244
|
-
this.projectService.cdProject(name);
|
|
245
|
-
}
|
|
246
|
-
const project = this.projectService.get();
|
|
233
|
+
const project = this.projectService.get(name);
|
|
247
234
|
project.clearDomains();
|
|
248
235
|
for (const domain of domains) {
|
|
249
236
|
project.addDomain(domain);
|
|
@@ -251,28 +238,19 @@ let ProjectController = class ProjectController {
|
|
|
251
238
|
project.save();
|
|
252
239
|
}
|
|
253
240
|
async removeDomain(removeDomains, name) {
|
|
254
|
-
|
|
255
|
-
this.projectService.cdProject(name);
|
|
256
|
-
}
|
|
257
|
-
const project = this.projectService.get();
|
|
241
|
+
const project = this.projectService.get(name);
|
|
258
242
|
for (const domain of removeDomains) {
|
|
259
243
|
project.removeDomain(domain);
|
|
260
244
|
}
|
|
261
245
|
project.save();
|
|
262
246
|
}
|
|
263
247
|
async clearDomain(name) {
|
|
264
|
-
|
|
265
|
-
this.projectService.cdProject(name);
|
|
266
|
-
}
|
|
267
|
-
const project = this.projectService.get();
|
|
248
|
+
const project = this.projectService.get(name);
|
|
268
249
|
project.clearDomains();
|
|
269
250
|
project.save();
|
|
270
251
|
}
|
|
271
252
|
async ports(name) {
|
|
272
|
-
|
|
273
|
-
this.projectService.cdProject(name);
|
|
274
|
-
}
|
|
275
|
-
const project = this.projectService.get();
|
|
253
|
+
const project = this.projectService.get(name);
|
|
276
254
|
const table = new cli_table3_1.default({
|
|
277
255
|
head: ["Ports"]
|
|
278
256
|
});
|
|
@@ -282,38 +260,26 @@ let ProjectController = class ProjectController {
|
|
|
282
260
|
return table.toString();
|
|
283
261
|
}
|
|
284
262
|
async addPort(hostPort, containerPort, name) {
|
|
285
|
-
|
|
286
|
-
this.projectService.cdProject(name);
|
|
287
|
-
}
|
|
288
|
-
const project = this.projectService.get();
|
|
263
|
+
const project = this.projectService.get(name);
|
|
289
264
|
project.linkPort(parseInt(hostPort), parseInt(containerPort));
|
|
290
265
|
project.save();
|
|
291
266
|
}
|
|
292
267
|
async removePort(hostPort, containerPort, name) {
|
|
293
|
-
|
|
294
|
-
this.projectService.cdProject(name);
|
|
295
|
-
}
|
|
296
|
-
const project = this.projectService.get();
|
|
268
|
+
const project = this.projectService.get(name);
|
|
297
269
|
project.unlinkPort(parseInt(hostPort), parseInt(containerPort));
|
|
298
270
|
project.save();
|
|
299
271
|
}
|
|
300
272
|
async clearPorts(name) {
|
|
301
|
-
|
|
302
|
-
this.projectService.cdProject(name);
|
|
303
|
-
}
|
|
304
|
-
const project = this.projectService.get();
|
|
273
|
+
const project = this.projectService.get(name);
|
|
305
274
|
if (project.ports) {
|
|
306
275
|
delete project.ports;
|
|
307
276
|
project.save();
|
|
308
277
|
}
|
|
309
278
|
}
|
|
310
279
|
async configList(name, global) {
|
|
311
|
-
if (name) {
|
|
312
|
-
this.projectService.cdProject(name);
|
|
313
|
-
}
|
|
314
280
|
let env;
|
|
315
281
|
if (!global) {
|
|
316
|
-
const project = this.projectService.get();
|
|
282
|
+
const project = this.projectService.get(name);
|
|
317
283
|
env = project.env || {};
|
|
318
284
|
}
|
|
319
285
|
else {
|
|
@@ -329,12 +295,9 @@ let ProjectController = class ProjectController {
|
|
|
329
295
|
return table.toString();
|
|
330
296
|
}
|
|
331
297
|
async configGet(keys, name, global) {
|
|
332
|
-
if (name) {
|
|
333
|
-
this.projectService.cdProject(name);
|
|
334
|
-
}
|
|
335
298
|
let config = global
|
|
336
299
|
? this.appConfigService.config
|
|
337
|
-
: this.projectService.get();
|
|
300
|
+
: this.projectService.get(name);
|
|
338
301
|
const table = new cli_table3_1.default({
|
|
339
302
|
head: ["KEY", "VALUE"]
|
|
340
303
|
});
|
|
@@ -359,10 +322,7 @@ let ProjectController = class ProjectController {
|
|
|
359
322
|
}
|
|
360
323
|
return;
|
|
361
324
|
}
|
|
362
|
-
|
|
363
|
-
this.projectService.cdProject(name);
|
|
364
|
-
}
|
|
365
|
-
const project = this.projectService.get();
|
|
325
|
+
const project = this.projectService.get(name);
|
|
366
326
|
for (const variable of variables) {
|
|
367
327
|
const [key, value] = variable.split("=");
|
|
368
328
|
if (!value) {
|
|
@@ -372,10 +332,6 @@ let ProjectController = class ProjectController {
|
|
|
372
332
|
project.setEnv(key, value);
|
|
373
333
|
}
|
|
374
334
|
project.save();
|
|
375
|
-
const container = await this.dockerService.getContainer(project.containerName);
|
|
376
|
-
if (container) {
|
|
377
|
-
await this.projectService.start(project, true);
|
|
378
|
-
}
|
|
379
335
|
}
|
|
380
336
|
async configUnset(configs, name, global) {
|
|
381
337
|
const env = configs.reduce((env, config) => {
|
|
@@ -386,27 +342,14 @@ let ProjectController = class ProjectController {
|
|
|
386
342
|
if (global) {
|
|
387
343
|
return;
|
|
388
344
|
}
|
|
389
|
-
|
|
390
|
-
this.projectService.cdProject(name);
|
|
391
|
-
}
|
|
392
|
-
const project = this.projectService.get();
|
|
345
|
+
const project = this.projectService.get(name);
|
|
393
346
|
for (const i in env) {
|
|
394
347
|
project.unsetEnv(i);
|
|
395
348
|
}
|
|
396
349
|
project.save();
|
|
397
|
-
if (!global) {
|
|
398
|
-
const project = this.projectService.get();
|
|
399
|
-
const container = await this.dockerService.getContainer(project.containerName);
|
|
400
|
-
if (container) {
|
|
401
|
-
await this.projectService.start(project, true);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
350
|
}
|
|
405
351
|
async buildArgsList(name) {
|
|
406
|
-
|
|
407
|
-
this.projectService.cdProject(name);
|
|
408
|
-
}
|
|
409
|
-
const project = this.projectService.get();
|
|
352
|
+
const project = this.projectService.get(name);
|
|
410
353
|
const table = new cli_table3_1.default({
|
|
411
354
|
head: ["KEY", "VALUE"]
|
|
412
355
|
});
|
|
@@ -417,10 +360,7 @@ let ProjectController = class ProjectController {
|
|
|
417
360
|
return table.toString();
|
|
418
361
|
}
|
|
419
362
|
async buildArgsGet(args, name) {
|
|
420
|
-
|
|
421
|
-
this.projectService.cdProject(name);
|
|
422
|
-
}
|
|
423
|
-
const project = this.projectService.get();
|
|
363
|
+
const project = this.projectService.get(name);
|
|
424
364
|
const table = new cli_table3_1.default({
|
|
425
365
|
head: ["KEY", "VALUE"]
|
|
426
366
|
});
|
|
@@ -433,10 +373,7 @@ let ProjectController = class ProjectController {
|
|
|
433
373
|
return table.toString();
|
|
434
374
|
}
|
|
435
375
|
async buildArgsSet(args, name) {
|
|
436
|
-
|
|
437
|
-
this.projectService.cdProject(name);
|
|
438
|
-
}
|
|
439
|
-
const project = this.projectService.get();
|
|
376
|
+
const project = this.projectService.get(name);
|
|
440
377
|
const buildArgs = args.reduce((env, config) => {
|
|
441
378
|
let [, key = "", value = ""] = config.split(/^([^=]+)=(.*)$/);
|
|
442
379
|
key = key.trim();
|
|
@@ -455,10 +392,7 @@ let ProjectController = class ProjectController {
|
|
|
455
392
|
project.save();
|
|
456
393
|
}
|
|
457
394
|
async buildArgsUnset(args, name) {
|
|
458
|
-
|
|
459
|
-
this.projectService.cdProject(name);
|
|
460
|
-
}
|
|
461
|
-
const project = this.projectService.get();
|
|
395
|
+
const project = this.projectService.get(name);
|
|
462
396
|
const buildArgs = args.reduce((env, config) => {
|
|
463
397
|
let [, key = "", value = ""] = config.split(/^([^=]+)(?:=(.*))?$/);
|
|
464
398
|
key = key.trim();
|
|
@@ -477,10 +411,7 @@ let ProjectController = class ProjectController {
|
|
|
477
411
|
project.save();
|
|
478
412
|
}
|
|
479
413
|
async volumeList(name) {
|
|
480
|
-
|
|
481
|
-
this.projectService.cdProject(name);
|
|
482
|
-
}
|
|
483
|
-
const project = this.projectService.get();
|
|
414
|
+
const project = this.projectService.get(name);
|
|
484
415
|
const table = new cli_table3_1.default({
|
|
485
416
|
head: ["Volume"]
|
|
486
417
|
});
|
|
@@ -491,30 +422,21 @@ let ProjectController = class ProjectController {
|
|
|
491
422
|
return table.toString();
|
|
492
423
|
}
|
|
493
424
|
async volumeMount(volumes, name) {
|
|
494
|
-
|
|
495
|
-
this.projectService.cdProject(name);
|
|
496
|
-
}
|
|
497
|
-
const project = this.projectService.get();
|
|
425
|
+
const project = this.projectService.get(name);
|
|
498
426
|
if (Array.isArray(volumes) && volumes.length > 0) {
|
|
499
427
|
project.volumeMount(...volumes);
|
|
500
428
|
project.save();
|
|
501
429
|
}
|
|
502
430
|
}
|
|
503
431
|
async volumeUnmount(volumes, name) {
|
|
504
|
-
|
|
505
|
-
this.projectService.cdProject(name);
|
|
506
|
-
}
|
|
507
|
-
const project = this.projectService.get();
|
|
432
|
+
const project = this.projectService.get(name);
|
|
508
433
|
if (Array.isArray(volumes) && volumes.length > 0) {
|
|
509
434
|
project.volumeUnmount(...volumes);
|
|
510
435
|
project.save();
|
|
511
436
|
}
|
|
512
437
|
}
|
|
513
438
|
async extraHostList(name) {
|
|
514
|
-
|
|
515
|
-
this.projectService.cdProject(name);
|
|
516
|
-
}
|
|
517
|
-
const project = this.projectService.get();
|
|
439
|
+
const project = this.projectService.get(name);
|
|
518
440
|
if (!project.extraHosts) {
|
|
519
441
|
return "No extra hosts found";
|
|
520
442
|
}
|
|
@@ -529,40 +451,25 @@ let ProjectController = class ProjectController {
|
|
|
529
451
|
return table.toString();
|
|
530
452
|
}
|
|
531
453
|
async addExtraHost(extraHost, extraDomain, name) {
|
|
532
|
-
|
|
533
|
-
this.projectService.cdProject(name);
|
|
534
|
-
}
|
|
535
|
-
const project = this.projectService.get();
|
|
454
|
+
const project = this.projectService.get(name);
|
|
536
455
|
project.addExtraHost(extraHost, extraDomain);
|
|
537
456
|
project.save();
|
|
538
457
|
}
|
|
539
458
|
async removeExtraHost(extraHost, name) {
|
|
540
|
-
|
|
541
|
-
this.projectService.cdProject(name);
|
|
542
|
-
}
|
|
543
|
-
const project = this.projectService.get();
|
|
459
|
+
const project = this.projectService.get(name);
|
|
544
460
|
project.removeExtraHost(extraHost);
|
|
545
461
|
project.save();
|
|
546
462
|
}
|
|
547
463
|
async attach(name) {
|
|
548
|
-
|
|
549
|
-
this.projectService.cdProject(name);
|
|
550
|
-
}
|
|
551
|
-
const project = this.projectService.get();
|
|
464
|
+
const project = this.projectService.get(name);
|
|
552
465
|
await this.dockerService.attach(project.containerName);
|
|
553
466
|
}
|
|
554
467
|
async exec(command, name) {
|
|
555
|
-
|
|
556
|
-
this.projectService.cdProject(name);
|
|
557
|
-
}
|
|
558
|
-
const project = this.projectService.get();
|
|
468
|
+
const project = this.projectService.get(name);
|
|
559
469
|
await this.dockerService.exec(project.containerName, command, true);
|
|
560
470
|
}
|
|
561
471
|
async run(script, args, name) {
|
|
562
|
-
|
|
563
|
-
this.projectService.cdProject(name);
|
|
564
|
-
}
|
|
565
|
-
const project = this.projectService.get();
|
|
472
|
+
const project = this.projectService.get(name);
|
|
566
473
|
if (!project.scripts || !project.scripts[script]) {
|
|
567
474
|
throw new Error(`Script ${script} not found`);
|
|
568
475
|
}
|
|
@@ -640,10 +547,8 @@ let ProjectController = class ProjectController {
|
|
|
640
547
|
}
|
|
641
548
|
return;
|
|
642
549
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
}
|
|
646
|
-
await this.projectService.logs(detach);
|
|
550
|
+
const project = this.projectService.get(name);
|
|
551
|
+
await this.projectService.logs(project, detach);
|
|
647
552
|
}
|
|
648
553
|
};
|
|
649
554
|
exports.ProjectController = ProjectController;
|
|
@@ -696,51 +601,6 @@ __decorate([
|
|
|
696
601
|
__metadata("design:paramtypes", [Boolean]),
|
|
697
602
|
__metadata("design:returntype", Promise)
|
|
698
603
|
], ProjectController.prototype, "projectList", null);
|
|
699
|
-
__decorate([
|
|
700
|
-
(0, core_1.Command)("start"),
|
|
701
|
-
(0, core_1.Description)("Starting project"),
|
|
702
|
-
__param(0, (0, core_1.Option)("name", {
|
|
703
|
-
type: "string",
|
|
704
|
-
alias: "n",
|
|
705
|
-
description: "The name of the project",
|
|
706
|
-
help: true
|
|
707
|
-
})),
|
|
708
|
-
__param(1, (0, core_1.Option)("detach", {
|
|
709
|
-
type: "boolean",
|
|
710
|
-
description: "Detach",
|
|
711
|
-
alias: "d"
|
|
712
|
-
})),
|
|
713
|
-
__param(2, (0, core_1.Option)("attach", {
|
|
714
|
-
type: "boolean",
|
|
715
|
-
description: "Attach",
|
|
716
|
-
alias: "a"
|
|
717
|
-
})),
|
|
718
|
-
__param(3, (0, core_1.Option)("build", {
|
|
719
|
-
type: "boolean",
|
|
720
|
-
description: "Build",
|
|
721
|
-
alias: "b"
|
|
722
|
-
})),
|
|
723
|
-
__param(4, (0, core_1.Option)("restart", {
|
|
724
|
-
type: "boolean",
|
|
725
|
-
alias: "r",
|
|
726
|
-
description: "Restart"
|
|
727
|
-
})),
|
|
728
|
-
__metadata("design:type", Function),
|
|
729
|
-
__metadata("design:paramtypes", [String, Boolean, Boolean, Boolean, Boolean]),
|
|
730
|
-
__metadata("design:returntype", Promise)
|
|
731
|
-
], ProjectController.prototype, "start", null);
|
|
732
|
-
__decorate([
|
|
733
|
-
(0, core_1.Command)("stop"),
|
|
734
|
-
(0, core_1.Description)("Stopping project"),
|
|
735
|
-
__param(0, (0, core_1.Option)("name", {
|
|
736
|
-
type: "string",
|
|
737
|
-
alias: "n",
|
|
738
|
-
description: "The name of the project"
|
|
739
|
-
})),
|
|
740
|
-
__metadata("design:type", Function),
|
|
741
|
-
__metadata("design:paramtypes", [String]),
|
|
742
|
-
__metadata("design:returntype", Promise)
|
|
743
|
-
], ProjectController.prototype, "stop", null);
|
|
744
604
|
__decorate([
|
|
745
605
|
(0, core_1.Command)("domains"),
|
|
746
606
|
(0, core_1.Description)("Project domain list"),
|
|
@@ -1094,7 +954,7 @@ __decorate([
|
|
|
1094
954
|
type: "boolean",
|
|
1095
955
|
alias: "f"
|
|
1096
956
|
})),
|
|
1097
|
-
__param(4, (0, core_1.Option)("clear",
|
|
957
|
+
__param(4, (0, core_1.Option)("clear", "c")),
|
|
1098
958
|
__metadata("design:type", Function),
|
|
1099
959
|
__metadata("design:paramtypes", [String, Boolean, Boolean, Boolean, Boolean]),
|
|
1100
960
|
__metadata("design:returntype", Promise)
|
|
@@ -1102,9 +962,11 @@ __decorate([
|
|
|
1102
962
|
exports.ProjectController = ProjectController = __decorate([
|
|
1103
963
|
(0, core_1.Controller)(),
|
|
1104
964
|
(0, core_1.Description)("Project commands"),
|
|
1105
|
-
__metadata("design:paramtypes", [
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
965
|
+
__metadata("design:paramtypes", [core_1.AppConfigService,
|
|
966
|
+
core_1.ProcessService,
|
|
967
|
+
core_1.EventService,
|
|
968
|
+
project_1.ProjectService,
|
|
969
|
+
project_1.ProjectRepository,
|
|
970
|
+
core_1.LogService,
|
|
971
|
+
docker_1.DockerService])
|
|
1110
972
|
], ProjectController);
|
package/lib/controllers/index.js
CHANGED
|
@@ -18,5 +18,4 @@ __exportStar(require("./CompletionController"), exports);
|
|
|
18
18
|
__exportStar(require("./DebugController"), exports);
|
|
19
19
|
__exportStar(require("./ExperimentalController"), exports);
|
|
20
20
|
__exportStar(require("./PluginController"), exports);
|
|
21
|
-
__exportStar(require("./PresetController"), exports);
|
|
22
21
|
__exportStar(require("./ProjectController"), exports);
|
package/lib/env.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const WOCKER_VERSION = "1.0.
|
|
1
|
+
export declare const WOCKER_VERSION = "1.0.24";
|
|
2
2
|
export declare const NODE_ENV: string;
|
|
3
3
|
export declare const ROOT_DIR: string;
|
|
4
4
|
export declare const PRESETS_DIR: string;
|
|
5
5
|
export declare const PLUGINS_DIR: string;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const WOCKER_DATA_DIR: string;
|
|
7
7
|
export declare const VIRTUAL_HOST_KEY = "VIRTUAL_HOST";
|
|
8
8
|
export declare const KEYTAR_SERVICE: string;
|
package/lib/env.js
CHANGED
|
@@ -33,14 +33,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.KEYTAR_SERVICE = exports.VIRTUAL_HOST_KEY = exports.
|
|
36
|
+
exports.KEYTAR_SERVICE = exports.VIRTUAL_HOST_KEY = exports.WOCKER_DATA_DIR = exports.PLUGINS_DIR = exports.PRESETS_DIR = exports.ROOT_DIR = exports.NODE_ENV = exports.WOCKER_VERSION = void 0;
|
|
37
37
|
const OS = __importStar(require("os"));
|
|
38
38
|
const Path = __importStar(require("path"));
|
|
39
|
-
exports.WOCKER_VERSION = "1.0.
|
|
39
|
+
exports.WOCKER_VERSION = "1.0.24";
|
|
40
40
|
exports.NODE_ENV = process.env.NODE_ENV;
|
|
41
41
|
exports.ROOT_DIR = Path.join(__dirname, "..");
|
|
42
42
|
exports.PRESETS_DIR = Path.join(exports.ROOT_DIR, "presets");
|
|
43
43
|
exports.PLUGINS_DIR = Path.join(exports.ROOT_DIR, "plugins");
|
|
44
|
-
exports.
|
|
44
|
+
exports.WOCKER_DATA_DIR = process.env.WS_DIR || Path.join(OS.homedir(), ".workspace");
|
|
45
45
|
exports.VIRTUAL_HOST_KEY = "VIRTUAL_HOST";
|
|
46
46
|
exports.KEYTAR_SERVICE = process.env.WOCKER_KEYTAR_SERVICE || "wocker";
|
package/lib/main.js
CHANGED
|
@@ -6,16 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.app = void 0;
|
|
7
7
|
const core_1 = require("@wocker/core");
|
|
8
8
|
const yoctocolors_cjs_1 = __importDefault(require("yoctocolors-cjs"));
|
|
9
|
-
const
|
|
10
|
-
const AppConfigService_1 = require("./services/AppConfigService");
|
|
11
|
-
const LogService_1 = require("./services/LogService");
|
|
9
|
+
const RootModule_1 = require("./RootModule");
|
|
12
10
|
exports.app = {
|
|
13
11
|
async run(args) {
|
|
14
|
-
const
|
|
15
|
-
const configService = app.get(AppConfigService_1.AppConfigService);
|
|
16
|
-
const logger = app.get(LogService_1.LogService);
|
|
12
|
+
const context = await core_1.Factory.create(RootModule_1.RootModule), appConfigService = context.get(core_1.AppConfigService), logService = context.get(core_1.LogService);
|
|
17
13
|
try {
|
|
18
|
-
const res = await
|
|
14
|
+
const res = await context.run(args);
|
|
19
15
|
if (res) {
|
|
20
16
|
process.stdout.write(res);
|
|
21
17
|
process.stdout.write("\n");
|
|
@@ -32,8 +28,8 @@ exports.app = {
|
|
|
32
28
|
if (err instanceof core_1.CommandNotFoundError) {
|
|
33
29
|
return;
|
|
34
30
|
}
|
|
35
|
-
if (
|
|
36
|
-
|
|
31
|
+
if (appConfigService.debug) {
|
|
32
|
+
logService.error(err.stack || err.toString());
|
|
37
33
|
}
|
|
38
34
|
}
|
|
39
35
|
}
|
package/lib/makes/index.d.ts
CHANGED
package/lib/makes/index.js
CHANGED
|
@@ -15,5 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./Http"), exports);
|
|
18
|
-
__exportStar(require("./Logger"), exports);
|
|
19
18
|
__exportStar(require("./Plugin"), exports);
|
package/lib/modules/app/index.js
CHANGED
|
@@ -8,9 +8,25 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.AppModule = void 0;
|
|
10
10
|
const core_1 = require("@wocker/core");
|
|
11
|
+
const env_1 = require("../../env");
|
|
11
12
|
let AppModule = class AppModule {
|
|
12
13
|
};
|
|
13
14
|
exports.AppModule = AppModule;
|
|
14
15
|
exports.AppModule = AppModule = __decorate([
|
|
15
|
-
(0, core_1.Module)({
|
|
16
|
+
(0, core_1.Module)({
|
|
17
|
+
providers: [
|
|
18
|
+
{
|
|
19
|
+
provide: core_1.WOCKER_VERSION_KEY,
|
|
20
|
+
useValue: env_1.WOCKER_VERSION
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
provide: core_1.WOCKER_DATA_DIR_KEY,
|
|
24
|
+
useValue: env_1.WOCKER_DATA_DIR
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
exports: [
|
|
28
|
+
core_1.WOCKER_VERSION_KEY,
|
|
29
|
+
core_1.WOCKER_DATA_DIR_KEY
|
|
30
|
+
]
|
|
31
|
+
})
|
|
16
32
|
], AppModule);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ContainerService } from "./services/ContainerService";
|
|
2
|
-
import { ImageService } from "./services/ImageService";
|
|
3
2
|
import { DockerService } from "./services/DockerService";
|
|
3
|
+
import { ImageService } from "./services/ImageService";
|
|
4
4
|
import { ModemService } from "./services/ModemService";
|
|
5
5
|
import { ProtoService } from "./services/ProtoService";
|
|
6
6
|
export declare class DockerModule {
|
|
7
7
|
}
|
|
8
|
-
export { ContainerService,
|
|
8
|
+
export { ContainerService, DockerService, ImageService, ModemService, ProtoService };
|
|
@@ -6,14 +6,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.ProtoService = exports.ModemService = exports.
|
|
9
|
+
exports.ProtoService = exports.ModemService = exports.ImageService = exports.DockerService = exports.ContainerService = exports.DockerModule = void 0;
|
|
10
10
|
const core_1 = require("@wocker/core");
|
|
11
11
|
const ContainerService_1 = require("./services/ContainerService");
|
|
12
12
|
Object.defineProperty(exports, "ContainerService", { enumerable: true, get: function () { return ContainerService_1.ContainerService; } });
|
|
13
|
-
const ImageService_1 = require("./services/ImageService");
|
|
14
|
-
Object.defineProperty(exports, "ImageService", { enumerable: true, get: function () { return ImageService_1.ImageService; } });
|
|
15
13
|
const DockerService_1 = require("./services/DockerService");
|
|
16
14
|
Object.defineProperty(exports, "DockerService", { enumerable: true, get: function () { return DockerService_1.DockerService; } });
|
|
15
|
+
const ImageService_1 = require("./services/ImageService");
|
|
16
|
+
Object.defineProperty(exports, "ImageService", { enumerable: true, get: function () { return ImageService_1.ImageService; } });
|
|
17
17
|
const ModemService_1 = require("./services/ModemService");
|
|
18
18
|
Object.defineProperty(exports, "ModemService", { enumerable: true, get: function () { return ModemService_1.ModemService; } });
|
|
19
19
|
const ProtoService_1 = require("./services/ProtoService");
|
|
@@ -25,15 +25,15 @@ exports.DockerModule = DockerModule = __decorate([
|
|
|
25
25
|
(0, core_1.Module)({
|
|
26
26
|
providers: [
|
|
27
27
|
ContainerService_1.ContainerService,
|
|
28
|
-
ImageService_1.ImageService,
|
|
29
28
|
DockerService_1.DockerService,
|
|
29
|
+
ImageService_1.ImageService,
|
|
30
30
|
ModemService_1.ModemService,
|
|
31
31
|
ProtoService_1.ProtoService
|
|
32
32
|
],
|
|
33
33
|
exports: [
|
|
34
34
|
ContainerService_1.ContainerService,
|
|
35
|
-
ImageService_1.ImageService,
|
|
36
35
|
DockerService_1.DockerService,
|
|
36
|
+
ImageService_1.ImageService,
|
|
37
37
|
ModemService_1.ModemService,
|
|
38
38
|
ProtoService_1.ProtoService
|
|
39
39
|
]
|