@wocker/ws 1.0.13 → 1.0.15
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.js +3 -2
- package/lib/controllers/PresetController.d.ts +2 -1
- package/lib/controllers/PresetController.js +31 -4
- package/lib/controllers/ProjectController.d.ts +12 -3
- package/lib/controllers/ProjectController.js +259 -51
- package/lib/controllers/ProxyController.d.ts +5 -12
- package/lib/controllers/ProxyController.js +25 -220
- package/lib/env.d.ts +1 -0
- package/lib/env.js +2 -1
- package/lib/plugins/index.d.ts +0 -1
- package/lib/plugins/index.js +0 -1
- package/lib/services/DockerService.d.ts +1 -1
- package/lib/services/DockerService.js +20 -15
- package/lib/services/PluginService.js +1 -1
- package/lib/services/PresetService.d.ts +7 -3
- package/lib/services/PresetService.js +158 -21
- package/lib/services/ProjectService.d.ts +4 -6
- package/lib/services/ProjectService.js +34 -45
- package/lib/services/ProxyService.d.ts +14 -0
- package/lib/services/ProxyService.js +87 -0
- package/lib/services/index.d.ts +1 -0
- package/lib/services/index.js +1 -0
- package/package.json +5 -3
- package/presets/bun/config.json +1 -0
- package/presets/go/config.json +1 -0
- package/presets/php-fpm/config.json +1 -0
- package/presets/shopify/config.json +2 -0
- package/lib/plugins/PageKitePlugin.d.ts +0 -30
- package/lib/plugins/PageKitePlugin.js +0 -145
- package/plugins/pagekite/Dockerfile +0 -3
- package/presets/node/Dockerfile +0 -39
- package/presets/node/config.json +0 -39
- package/presets/php-apache/Dockerfile +0 -227
- package/presets/php-apache/bin/compare-version +0 -3
- package/presets/php-apache/config.json +0 -64
- package/presets/php-apache/etc/apache2/apache2.conf +0 -230
- package/presets/php-apache/etc/apache2/mods-available/mpm_prefork.conf +0 -16
- package/presets/php-apache/etc/apache2/sites-available/000-default.conf +0 -21
|
@@ -18,23 +18,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.ProxyController = void 0;
|
|
19
19
|
const core_1 = require("@wocker/core");
|
|
20
20
|
const utils_1 = require("@wocker/utils");
|
|
21
|
-
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
22
21
|
const chalk_1 = __importDefault(require("chalk"));
|
|
23
|
-
const makes_1 = require("../makes");
|
|
24
22
|
const services_1 = require("../services");
|
|
25
23
|
let ProxyController = class ProxyController {
|
|
26
|
-
constructor(appConfigService, appEventsService, projectService,
|
|
24
|
+
constructor(appConfigService, appEventsService, projectService, proxyService) {
|
|
27
25
|
this.appConfigService = appConfigService;
|
|
28
26
|
this.appEventsService = appEventsService;
|
|
29
27
|
this.projectService = projectService;
|
|
30
|
-
this.
|
|
28
|
+
this.proxyService = proxyService;
|
|
31
29
|
this.containerName = "proxy.workspace";
|
|
32
|
-
this.appEventsService.on("project:
|
|
30
|
+
this.appEventsService.on("project:init", (project) => this.proxyService.init(project));
|
|
31
|
+
this.appEventsService.on("project:start", (project) => this.onProjectStart(project));
|
|
33
32
|
this.appEventsService.on("project:stop", (project) => this.onProjectStop(project));
|
|
34
33
|
}
|
|
35
34
|
async onProjectStart(project) {
|
|
36
|
-
if (
|
|
37
|
-
|
|
35
|
+
if (project.domains.length === 0) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
console.info(chalk_1.default.green("Don't forget to add these lines into hosts file:"));
|
|
39
|
+
for (const domain of project.domains) {
|
|
40
|
+
console.info(chalk_1.default.gray(`127.0.0.1 ${domain}`));
|
|
38
41
|
}
|
|
39
42
|
await this.start();
|
|
40
43
|
}
|
|
@@ -44,173 +47,37 @@ let ProxyController = class ProxyController {
|
|
|
44
47
|
const projects = await this.projectService.search();
|
|
45
48
|
return projects.map((project) => project.name);
|
|
46
49
|
}
|
|
47
|
-
async getDomains(name, selected) {
|
|
48
|
-
if (name) {
|
|
49
|
-
await this.projectService.cdProject(name);
|
|
50
|
-
}
|
|
51
|
-
const project = await this.projectService.get();
|
|
52
|
-
return (project.getEnv("VIRTUAL_HOST") || "").split(",").filter((domain) => {
|
|
53
|
-
return !selected.includes(domain);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
50
|
async init(httpPort, httpsPort) {
|
|
57
51
|
const config = await this.appConfigService.getConfig();
|
|
58
|
-
if (typeof httpPort === "undefined" || isNaN(httpPort)) {
|
|
52
|
+
if (httpPort === null || typeof httpPort === "undefined" || isNaN(httpPort)) {
|
|
59
53
|
httpPort = await (0, utils_1.promptText)({
|
|
60
54
|
required: true,
|
|
61
55
|
message: "Http port:",
|
|
62
|
-
type: "
|
|
56
|
+
type: "number",
|
|
63
57
|
default: config.getMeta("PROXY_HTTP_PORT", "80")
|
|
64
58
|
});
|
|
65
59
|
}
|
|
66
60
|
config.setMeta("PROXY_HTTP_PORT", httpPort.toString());
|
|
67
|
-
if (typeof httpsPort === "undefined" || isNaN(httpsPort)) {
|
|
61
|
+
if (httpsPort === null || typeof httpsPort === "undefined" || isNaN(httpsPort)) {
|
|
68
62
|
httpsPort = await (0, utils_1.promptText)({
|
|
69
63
|
required: true,
|
|
70
64
|
message: "Https port:",
|
|
71
|
-
type: "
|
|
65
|
+
type: "number",
|
|
72
66
|
default: config.getMeta("PROXY_HTTPS_PORT", "443")
|
|
73
67
|
});
|
|
74
68
|
}
|
|
75
69
|
config.setMeta("PROXY_HTTPS_PORT", httpsPort.toString());
|
|
76
70
|
await config.save();
|
|
77
71
|
}
|
|
78
|
-
async start() {
|
|
79
|
-
|
|
80
|
-
const config = await this.appConfigService.getConfig();
|
|
81
|
-
await this.dockerService.pullImage("nginxproxy/nginx-proxy");
|
|
82
|
-
const httpPort = config.getMeta("PROXY_HTTP_PORT", "80");
|
|
83
|
-
const httpsPort = config.getMeta("PROXY_HTTPS_PORT", "443");
|
|
84
|
-
let container = await this.dockerService.getContainer(this.containerName);
|
|
85
|
-
if (!container) {
|
|
86
|
-
const certsDir = this.appConfigService.dataPath("certs");
|
|
87
|
-
if (!makes_1.FS.existsSync(certsDir)) {
|
|
88
|
-
makes_1.FS.mkdirSync(certsDir, {
|
|
89
|
-
recursive: true
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
container = await this.dockerService.createContainer({
|
|
93
|
-
name: this.containerName,
|
|
94
|
-
image: "nginxproxy/nginx-proxy",
|
|
95
|
-
restart: "always",
|
|
96
|
-
env: {
|
|
97
|
-
DEFAULT_HOST: "index.workspace"
|
|
98
|
-
},
|
|
99
|
-
ports: [
|
|
100
|
-
`${httpPort}:80`,
|
|
101
|
-
`${httpsPort}:443`
|
|
102
|
-
],
|
|
103
|
-
volumes: [
|
|
104
|
-
"/var/run/docker.sock:/tmp/docker.sock:ro",
|
|
105
|
-
`${certsDir}:/etc/nginx/certs`
|
|
106
|
-
]
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
const { State: { Status } } = await container.inspect();
|
|
110
|
-
if (["created", "exited"].includes(Status)) {
|
|
111
|
-
console.info("Starting...", Status);
|
|
112
|
-
await container.start();
|
|
113
|
-
}
|
|
72
|
+
async start(restart) {
|
|
73
|
+
await this.proxyService.start(restart);
|
|
114
74
|
}
|
|
115
75
|
async stop() {
|
|
116
76
|
console.info("Proxy stopping...");
|
|
117
|
-
await this.
|
|
118
|
-
}
|
|
119
|
-
async restart() {
|
|
120
|
-
await this.stop();
|
|
121
|
-
await this.start();
|
|
122
|
-
}
|
|
123
|
-
async domainList(name) {
|
|
124
|
-
if (name) {
|
|
125
|
-
await this.projectService.cdProject(name);
|
|
126
|
-
}
|
|
127
|
-
const project = await this.projectService.get();
|
|
128
|
-
const table = new cli_table3_1.default({
|
|
129
|
-
head: [chalk_1.default.yellow("Domain")]
|
|
130
|
-
});
|
|
131
|
-
const domains = project.getEnv("VIRTUAL_HOST", "").split(",");
|
|
132
|
-
for (const domain of domains) {
|
|
133
|
-
table.push([domain]);
|
|
134
|
-
}
|
|
135
|
-
return table.toString() + "\n";
|
|
136
|
-
}
|
|
137
|
-
async setDomains(name, domains) {
|
|
138
|
-
if (name) {
|
|
139
|
-
await this.projectService.cdProject(name);
|
|
140
|
-
}
|
|
141
|
-
const project = await this.projectService.get();
|
|
142
|
-
project.setEnv("VIRTUAL_HOST", domains.join(","));
|
|
143
|
-
await project.save();
|
|
144
|
-
const container = await this.dockerService.getContainer(`${project.name}.workspace`);
|
|
145
|
-
if (container) {
|
|
146
|
-
await this.projectService.stop(project);
|
|
147
|
-
await this.projectService.start(project);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
async addDomain(name, addDomains) {
|
|
151
|
-
if (name) {
|
|
152
|
-
await this.projectService.cdProject(name);
|
|
153
|
-
}
|
|
154
|
-
const project = await this.projectService.get();
|
|
155
|
-
let domains = project.getEnv("VIRTUAL_HOST", "").split(",").filter((domain) => {
|
|
156
|
-
return !!domain;
|
|
157
|
-
});
|
|
158
|
-
domains = [
|
|
159
|
-
...domains,
|
|
160
|
-
...addDomains.filter((domain) => {
|
|
161
|
-
return !domains.find((existDomain) => {
|
|
162
|
-
return existDomain === domain;
|
|
163
|
-
});
|
|
164
|
-
})
|
|
165
|
-
];
|
|
166
|
-
project.setEnv("VIRTUAL_HOST", domains.join(","));
|
|
167
|
-
await project.save();
|
|
168
|
-
const container = await this.dockerService.getContainer(`${project.name}.workspace`);
|
|
169
|
-
if (container) {
|
|
170
|
-
await this.projectService.stop(project);
|
|
171
|
-
await this.projectService.start(project);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
async removeDomain(name, removeDomains) {
|
|
175
|
-
if (name) {
|
|
176
|
-
await this.projectService.cdProject(name);
|
|
177
|
-
}
|
|
178
|
-
const project = await this.projectService.get();
|
|
179
|
-
let domains = project.getEnv("VIRTUAL_HOST", "").split(",").filter((domain) => {
|
|
180
|
-
return !!domain;
|
|
181
|
-
});
|
|
182
|
-
domains = domains.filter((domain) => {
|
|
183
|
-
return !removeDomains.includes(domain);
|
|
184
|
-
});
|
|
185
|
-
project.setEnv("VIRTUAL_HOST", domains.join(","));
|
|
186
|
-
await project.save();
|
|
187
|
-
}
|
|
188
|
-
async clearDomains(name) {
|
|
189
|
-
if (name) {
|
|
190
|
-
await this.projectService.cdProject(name);
|
|
191
|
-
}
|
|
192
|
-
const project = await this.projectService.get();
|
|
193
|
-
project.unsetEnv("VIRTUAL_HOST");
|
|
194
|
-
await project.save();
|
|
195
|
-
const container = await this.dockerService.getContainer(`${project.name}.workspace`);
|
|
196
|
-
if (container) {
|
|
197
|
-
await this.projectService.stop(project);
|
|
198
|
-
await this.projectService.start(project);
|
|
199
|
-
}
|
|
77
|
+
await this.proxyService.stop();
|
|
200
78
|
}
|
|
201
79
|
async logs() {
|
|
202
|
-
|
|
203
|
-
if (!container) {
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
const stream = await container.logs({
|
|
207
|
-
follow: true,
|
|
208
|
-
stdout: true,
|
|
209
|
-
stderr: true
|
|
210
|
-
});
|
|
211
|
-
stream.on("data", (data) => {
|
|
212
|
-
process.stdout.write((0, utils_1.demuxOutput)(data));
|
|
213
|
-
});
|
|
80
|
+
await this.proxyService.logs();
|
|
214
81
|
}
|
|
215
82
|
};
|
|
216
83
|
exports.ProxyController = ProxyController;
|
|
@@ -220,12 +87,6 @@ __decorate([
|
|
|
220
87
|
__metadata("design:paramtypes", []),
|
|
221
88
|
__metadata("design:returntype", Promise)
|
|
222
89
|
], ProxyController.prototype, "getProjectNames", null);
|
|
223
|
-
__decorate([
|
|
224
|
-
(0, core_1.Command)("domains"),
|
|
225
|
-
__metadata("design:type", Function),
|
|
226
|
-
__metadata("design:paramtypes", [String, Array]),
|
|
227
|
-
__metadata("design:returntype", Promise)
|
|
228
|
-
], ProxyController.prototype, "getDomains", null);
|
|
229
90
|
__decorate([
|
|
230
91
|
(0, core_1.Command)("proxy:init"),
|
|
231
92
|
__param(0, (0, core_1.Option)("http-port", {
|
|
@@ -242,8 +103,13 @@ __decorate([
|
|
|
242
103
|
], ProxyController.prototype, "init", null);
|
|
243
104
|
__decorate([
|
|
244
105
|
(0, core_1.Command)("proxy:start"),
|
|
106
|
+
__param(0, (0, core_1.Option)("restart", {
|
|
107
|
+
type: "boolean",
|
|
108
|
+
alias: "r",
|
|
109
|
+
description: "Restart"
|
|
110
|
+
})),
|
|
245
111
|
__metadata("design:type", Function),
|
|
246
|
-
__metadata("design:paramtypes", []),
|
|
112
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
247
113
|
__metadata("design:returntype", Promise)
|
|
248
114
|
], ProxyController.prototype, "start", null);
|
|
249
115
|
__decorate([
|
|
@@ -252,67 +118,6 @@ __decorate([
|
|
|
252
118
|
__metadata("design:paramtypes", []),
|
|
253
119
|
__metadata("design:returntype", Promise)
|
|
254
120
|
], ProxyController.prototype, "stop", null);
|
|
255
|
-
__decorate([
|
|
256
|
-
(0, core_1.Command)("proxy:restart"),
|
|
257
|
-
__metadata("design:type", Function),
|
|
258
|
-
__metadata("design:paramtypes", []),
|
|
259
|
-
__metadata("design:returntype", Promise)
|
|
260
|
-
], ProxyController.prototype, "restart", null);
|
|
261
|
-
__decorate([
|
|
262
|
-
(0, core_1.Command)("domains"),
|
|
263
|
-
__param(0, (0, core_1.Option)("name", {
|
|
264
|
-
type: "string",
|
|
265
|
-
alias: "n",
|
|
266
|
-
description: "Project name"
|
|
267
|
-
})),
|
|
268
|
-
__metadata("design:type", Function),
|
|
269
|
-
__metadata("design:paramtypes", [String]),
|
|
270
|
-
__metadata("design:returntype", Promise)
|
|
271
|
-
], ProxyController.prototype, "domainList", null);
|
|
272
|
-
__decorate([
|
|
273
|
-
(0, core_1.Command)("domain:set [...domains]"),
|
|
274
|
-
__param(0, (0, core_1.Option)("name", {
|
|
275
|
-
type: "string",
|
|
276
|
-
alias: "n",
|
|
277
|
-
description: "Project name"
|
|
278
|
-
})),
|
|
279
|
-
__metadata("design:type", Function),
|
|
280
|
-
__metadata("design:paramtypes", [String, Array]),
|
|
281
|
-
__metadata("design:returntype", Promise)
|
|
282
|
-
], ProxyController.prototype, "setDomains", null);
|
|
283
|
-
__decorate([
|
|
284
|
-
(0, core_1.Command)("domain:add [...domains]"),
|
|
285
|
-
__param(0, (0, core_1.Option)("name", {
|
|
286
|
-
type: "string",
|
|
287
|
-
alias: "n",
|
|
288
|
-
description: "Project name"
|
|
289
|
-
})),
|
|
290
|
-
__metadata("design:type", Function),
|
|
291
|
-
__metadata("design:paramtypes", [String, Array]),
|
|
292
|
-
__metadata("design:returntype", Promise)
|
|
293
|
-
], ProxyController.prototype, "addDomain", null);
|
|
294
|
-
__decorate([
|
|
295
|
-
(0, core_1.Command)("domain:remove [...domains]"),
|
|
296
|
-
__param(0, (0, core_1.Option)("name", {
|
|
297
|
-
type: "string",
|
|
298
|
-
alias: "n",
|
|
299
|
-
description: "Project name"
|
|
300
|
-
})),
|
|
301
|
-
__metadata("design:type", Function),
|
|
302
|
-
__metadata("design:paramtypes", [String, Array]),
|
|
303
|
-
__metadata("design:returntype", Promise)
|
|
304
|
-
], ProxyController.prototype, "removeDomain", null);
|
|
305
|
-
__decorate([
|
|
306
|
-
(0, core_1.Command)("domain:clear"),
|
|
307
|
-
__param(0, (0, core_1.Option)("name", {
|
|
308
|
-
type: "string",
|
|
309
|
-
alias: "n",
|
|
310
|
-
description: "Project name"
|
|
311
|
-
})),
|
|
312
|
-
__metadata("design:type", Function),
|
|
313
|
-
__metadata("design:paramtypes", [String]),
|
|
314
|
-
__metadata("design:returntype", Promise)
|
|
315
|
-
], ProxyController.prototype, "clearDomains", null);
|
|
316
121
|
__decorate([
|
|
317
122
|
(0, core_1.Command)("proxy:logs"),
|
|
318
123
|
__metadata("design:type", Function),
|
|
@@ -324,5 +129,5 @@ exports.ProxyController = ProxyController = __decorate([
|
|
|
324
129
|
__metadata("design:paramtypes", [services_1.AppConfigService,
|
|
325
130
|
services_1.AppEventsService,
|
|
326
131
|
services_1.ProjectService,
|
|
327
|
-
services_1.
|
|
132
|
+
services_1.ProxyService])
|
|
328
133
|
], ProxyController);
|
package/lib/env.d.ts
CHANGED
package/lib/env.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.MAP_PATH = exports.DATA_DIR = exports.PLUGINS_DIR = exports.SERVICES_DIR = exports.PRESETS_DIR = exports.ROOT_DIR = exports.NODE_ENV = void 0;
|
|
26
|
+
exports.VIRTUAL_HOST_KEY = exports.MAP_PATH = exports.DATA_DIR = exports.PLUGINS_DIR = exports.SERVICES_DIR = exports.PRESETS_DIR = exports.ROOT_DIR = exports.NODE_ENV = void 0;
|
|
27
27
|
const OS = __importStar(require("os"));
|
|
28
28
|
const Path = __importStar(require("path"));
|
|
29
29
|
exports.NODE_ENV = process.env.NODE_ENV;
|
|
@@ -33,3 +33,4 @@ exports.SERVICES_DIR = Path.join(exports.ROOT_DIR, "services");
|
|
|
33
33
|
exports.PLUGINS_DIR = Path.join(exports.ROOT_DIR, "plugins");
|
|
34
34
|
exports.DATA_DIR = process.env.WS_DIR || Path.join(OS.homedir(), ".workspace");
|
|
35
35
|
exports.MAP_PATH = Path.join(exports.DATA_DIR, "data.json");
|
|
36
|
+
exports.VIRTUAL_HOST_KEY = "VIRTUAL_HOST";
|
package/lib/plugins/index.d.ts
CHANGED
package/lib/plugins/index.js
CHANGED
|
@@ -16,5 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ElasticSearchPlugin"), exports);
|
|
18
18
|
__exportStar(require("./MongodbPlugin"), exports);
|
|
19
|
-
__exportStar(require("./PageKitePlugin"), exports);
|
|
20
19
|
__exportStar(require("./ProxmoxPlugin"), exports);
|
|
@@ -13,7 +13,7 @@ export declare class DockerService {
|
|
|
13
13
|
imageRm(tag: string): Promise<void>;
|
|
14
14
|
imageLs(options?: Params.ImageList): Promise<Docker.ImageInfo[]>;
|
|
15
15
|
pullImage(tag: string): Promise<void>;
|
|
16
|
-
attach(
|
|
16
|
+
attach(containerOrName: string | Container): Promise<NodeJS.ReadWriteStream>;
|
|
17
17
|
logs(name: string): Promise<void>;
|
|
18
18
|
attachStream(stream: NodeJS.ReadWriteStream): Promise<void>;
|
|
19
19
|
exec(name: string, args?: string[], tty?: boolean): Promise<import("stream").Duplex>;
|
|
@@ -94,7 +94,7 @@ let DockerService = class DockerService {
|
|
|
94
94
|
];
|
|
95
95
|
}
|
|
96
96
|
return res;
|
|
97
|
-
}, {})
|
|
97
|
+
}, {})
|
|
98
98
|
},
|
|
99
99
|
NetworkingConfig: {
|
|
100
100
|
EndpointsConfig: networkMode === "host" ? {} : {
|
|
@@ -173,8 +173,9 @@ let DockerService = class DockerService {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
async imageRm(tag) {
|
|
176
|
-
const image =
|
|
177
|
-
|
|
176
|
+
const image = this.docker.getImage(tag);
|
|
177
|
+
const exists = await this.imageExists(tag);
|
|
178
|
+
if (!exists) {
|
|
178
179
|
return;
|
|
179
180
|
}
|
|
180
181
|
await image.remove();
|
|
@@ -212,10 +213,16 @@ let DockerService = class DockerService {
|
|
|
212
213
|
const stream = await this.docker.pull(tag);
|
|
213
214
|
await (0, utils_2.followProgress)(stream);
|
|
214
215
|
}
|
|
215
|
-
async attach(
|
|
216
|
-
|
|
217
|
-
if (
|
|
218
|
-
|
|
216
|
+
async attach(containerOrName) {
|
|
217
|
+
let container;
|
|
218
|
+
if (typeof containerOrName === "string") {
|
|
219
|
+
container = await this.getContainer(containerOrName);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
if (!containerOrName) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
container = containerOrName;
|
|
219
226
|
}
|
|
220
227
|
const stream = await container.attach({
|
|
221
228
|
logs: true,
|
|
@@ -236,23 +243,21 @@ let DockerService = class DockerService {
|
|
|
236
243
|
}
|
|
237
244
|
});
|
|
238
245
|
stream.on("data", (data) => {
|
|
239
|
-
process.stdout.write(
|
|
246
|
+
process.stdout.write(data);
|
|
240
247
|
});
|
|
241
248
|
stream.on("end", async () => {
|
|
242
249
|
process.exit();
|
|
243
250
|
});
|
|
244
|
-
|
|
251
|
+
const handleResize = () => {
|
|
245
252
|
const [width, height] = process.stdout.getWindowSize();
|
|
246
253
|
container.resize({
|
|
247
254
|
w: width,
|
|
248
255
|
h: height
|
|
249
256
|
});
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
h: height
|
|
255
|
-
});
|
|
257
|
+
};
|
|
258
|
+
process.stdout.on("resize", handleResize);
|
|
259
|
+
handleResize();
|
|
260
|
+
return stream;
|
|
256
261
|
}
|
|
257
262
|
async logs(name) {
|
|
258
263
|
const container = await this.getContainer(name);
|
|
@@ -47,7 +47,7 @@ let PluginService = class PluginService {
|
|
|
47
47
|
async checkPlugin(pluginName) {
|
|
48
48
|
try {
|
|
49
49
|
const { default: Plugin } = await Promise.resolve(`${pluginName}`).then(s => __importStar(require(s)));
|
|
50
|
-
const name = Reflect.getMetadata(core_1.
|
|
50
|
+
const name = Reflect.getMetadata(core_1.PLUGIN_NAME_METADATA, Plugin);
|
|
51
51
|
if (!name) {
|
|
52
52
|
console.log("No name");
|
|
53
53
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { EnvConfig, Preset } from "@wocker/core";
|
|
1
|
+
import { EnvConfig, Preset, Config, PresetProperties, AppConfigService } from "@wocker/core";
|
|
2
2
|
type SearchOptions = Partial<{
|
|
3
3
|
name: string;
|
|
4
|
+
source: string;
|
|
4
5
|
}>;
|
|
5
6
|
export declare class PresetService {
|
|
6
|
-
|
|
7
|
+
protected readonly appConfigService: AppConfigService;
|
|
8
|
+
constructor(appConfigService: AppConfigService);
|
|
9
|
+
protected toObject(config: PresetProperties): Preset;
|
|
10
|
+
protected getList(): Promise<Config["presets"]>;
|
|
7
11
|
getImageName(preset: Preset, buildArgs?: EnvConfig): string;
|
|
8
|
-
save(preset: Preset): Promise<void>;
|
|
9
12
|
get(name: string): Promise<Preset>;
|
|
13
|
+
addPreset(name: string): Promise<void>;
|
|
10
14
|
search(options?: SearchOptions): Promise<Preset[]>;
|
|
11
15
|
searchOne(options?: SearchOptions): Promise<Preset | null>;
|
|
12
16
|
}
|