@wocker/ws 1.0.7 → 1.0.9
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/bin/ws.js +2 -13
- package/lib/AppModule.d.ts +6 -0
- package/lib/AppModule.js +100 -0
- package/lib/controllers/CompletionController.d.ts +6 -0
- package/lib/controllers/CompletionController.js +32 -0
- package/lib/controllers/DebugController.d.ts +7 -0
- package/lib/controllers/DebugController.js +44 -0
- package/lib/controllers/ImageController.d.ts +5 -8
- package/lib/controllers/ImageController.js +27 -12
- package/lib/controllers/PluginController.d.ts +11 -13
- package/lib/controllers/PluginController.js +93 -54
- package/lib/controllers/PresetController.d.ts +10 -15
- package/lib/controllers/PresetController.js +111 -27
- package/lib/controllers/ProjectController.d.ts +27 -70
- package/lib/controllers/ProjectController.js +357 -306
- package/lib/controllers/ProxyController.d.ts +15 -25
- package/lib/controllers/ProxyController.js +157 -102
- package/lib/controllers/index.d.ts +2 -0
- package/lib/controllers/index.js +2 -0
- package/lib/main.d.ts +3 -0
- package/lib/main.js +30 -0
- package/lib/makes/FS.d.ts +15 -5
- package/lib/makes/FS.js +42 -9
- package/lib/makes/Http.d.ts +18 -0
- package/lib/makes/{Plugin.js → Http.js} +45 -34
- package/lib/makes/Logger.d.ts +2 -2
- package/lib/makes/Logger.js +19 -8
- package/lib/makes/Preset.d.ts +5 -6
- package/lib/makes/Preset.js +19 -8
- package/lib/makes/index.d.ts +1 -6
- package/lib/makes/index.js +1 -6
- package/lib/plugins/ElasticSearchPlugin.d.ts +5 -6
- package/lib/plugins/ElasticSearchPlugin.js +19 -8
- package/lib/plugins/LocaltunnelPlugin.d.ts +8 -8
- package/lib/plugins/LocaltunnelPlugin.js +25 -10
- package/lib/plugins/MaildevPlugin.d.ts +5 -6
- package/lib/plugins/MaildevPlugin.js +21 -8
- package/lib/plugins/MongodbPlugin.d.ts +5 -5
- package/lib/plugins/MongodbPlugin.js +26 -11
- package/lib/plugins/NgrokPlugin.d.ts +7 -6
- package/lib/plugins/NgrokPlugin.js +32 -17
- package/lib/plugins/PageKitePlugin.d.ts +10 -8
- package/lib/plugins/PageKitePlugin.js +36 -20
- package/lib/plugins/ProxmoxPlugin.d.ts +8 -5
- package/lib/plugins/ProxmoxPlugin.js +25 -9
- package/lib/plugins/RedisPlugin.d.ts +4 -6
- package/lib/plugins/RedisPlugin.js +19 -8
- package/lib/plugins/index.d.ts +0 -2
- package/lib/plugins/index.js +0 -2
- package/lib/services/AppConfigService.d.ts +7 -17
- package/lib/services/AppConfigService.js +44 -114
- package/lib/services/AppEventsService.d.ts +1 -2
- package/lib/services/AppEventsService.js +11 -2
- package/lib/services/DockerService.d.ts +9 -39
- package/lib/services/DockerService.js +122 -4
- package/lib/services/LogService.d.ts +3 -5
- package/lib/services/LogService.js +19 -4
- package/lib/services/PluginService.d.ts +11 -9
- package/lib/services/PluginService.js +100 -8
- package/lib/services/PresetService.d.ts +4 -5
- package/lib/services/PresetService.js +26 -5
- package/lib/services/ProjectService.d.ts +9 -6
- package/lib/services/ProjectService.js +72 -37
- package/lib/utils/exec.d.ts +4 -1
- package/lib/utils/exec.js +16 -31
- package/lib/utils/followProgress.js +49 -45
- package/lib/utils/index.d.ts +0 -7
- package/lib/utils/index.js +0 -7
- package/lib/utils/spawn.d.ts +1 -1
- package/lib/utils/spawn.js +20 -12
- package/package.json +5 -7
- package/presets/node/config.json +1 -1
- package/presets/php-apache/Dockerfile +1 -1
- package/presets/php-apache/config.json +2 -1
- package/presets/php-fpm/Dockerfile +1 -1
- package/lib/App.d.ts +0 -16
- package/lib/App.js +0 -107
- package/lib/decorators/Inject.d.ts +0 -1
- package/lib/decorators/Inject.js +0 -8
- package/lib/decorators/Injectable.d.ts +0 -4
- package/lib/decorators/Injectable.js +0 -17
- package/lib/decorators/index.d.ts +0 -1
- package/lib/decorators/index.js +0 -17
- package/lib/index.d.ts +0 -6
- package/lib/index.js +0 -33
- package/lib/makes/Controller.d.ts +0 -5
- package/lib/makes/Controller.js +0 -8
- package/lib/makes/DI.d.ts +0 -7
- package/lib/makes/DI.js +0 -27
- package/lib/makes/Docker.d.ts +0 -58
- package/lib/makes/Docker.js +0 -320
- package/lib/makes/Plugin.d.ts +0 -13
- package/lib/makes/Project.d.ts +0 -45
- package/lib/makes/Project.js +0 -127
- package/lib/makes/Repository.d.ts +0 -11
- package/lib/makes/Repository.js +0 -22
- package/lib/plugins/PostgresPlugin.d.ts +0 -16
- package/lib/plugins/PostgresPlugin.js +0 -121
- package/lib/types/Config.d.ts +0 -12
- package/lib/types/Config.js +0 -2
- package/lib/types/EnvConfig.d.ts +0 -3
- package/lib/types/EnvConfig.js +0 -2
- package/lib/types/index.d.ts +0 -2
- package/lib/types/index.js +0 -18
- package/lib/utils/buildOptions.d.ts +0 -1
- package/lib/utils/buildOptions.js +0 -9
- package/lib/utils/demuxOutput.d.ts +0 -2
- package/lib/utils/demuxOutput.js +0 -19
- package/lib/utils/fetch.d.ts +0 -5
- package/lib/utils/fetch.js +0 -52
- package/lib/utils/get-config.d.ts +0 -2
- package/lib/utils/get-config.js +0 -17
- package/lib/utils/image-build.d.ts +0 -13
- package/lib/utils/image-build.js +0 -46
- package/lib/utils/set-config.d.ts +0 -2
- package/lib/utils/set-config.js +0 -15
- package/lib/utils/tty.d.ts +0 -2
- package/lib/utils/tty.js +0 -6
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.NgrokPlugin = void 0;
|
|
13
|
+
const core_1 = require("@wocker/core");
|
|
4
14
|
const utils_1 = require("@wocker/utils");
|
|
5
15
|
const makes_1 = require("../makes");
|
|
6
16
|
const services_1 = require("../services");
|
|
7
|
-
|
|
8
|
-
constructor(
|
|
9
|
-
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
17
|
+
let NgrokPlugin = class NgrokPlugin {
|
|
18
|
+
constructor(appEventsService, projectService, dockerService) {
|
|
19
|
+
this.appEventsService = appEventsService;
|
|
20
|
+
this.projectService = projectService;
|
|
21
|
+
this.dockerService = dockerService;
|
|
12
22
|
}
|
|
13
23
|
install(cli) {
|
|
14
|
-
super.install(cli);
|
|
15
24
|
this.appEventsService.on("project:start", (project) => this.onProjectStart(project));
|
|
16
25
|
this.appEventsService.on("project:stop", (project) => this.onProjectStop(project));
|
|
17
26
|
cli.command("ngrok:init")
|
|
@@ -98,12 +107,12 @@ class NgrokPlugin extends makes_1.Plugin {
|
|
|
98
107
|
await project.save();
|
|
99
108
|
}
|
|
100
109
|
async getForwarding(project) {
|
|
101
|
-
const container = await
|
|
110
|
+
const container = await this.dockerService.getContainer(`ngrok-${project.name}`);
|
|
102
111
|
if (!container) {
|
|
103
112
|
throw new Error(`Ngrok for "${project.name}" not started`);
|
|
104
113
|
}
|
|
105
114
|
const { NetworkSettings: { Networks: { workspace } } } = await container.inspect();
|
|
106
|
-
const stream = await
|
|
115
|
+
const stream = await this.dockerService.exec("proxy.workspace", [
|
|
107
116
|
"curl", `http://${workspace.IPAddress}:4040/api/tunnels/command_line`
|
|
108
117
|
], false);
|
|
109
118
|
const res = await new Promise((resolve, reject) => {
|
|
@@ -121,7 +130,7 @@ class NgrokPlugin extends makes_1.Plugin {
|
|
|
121
130
|
if (!project || project.getEnv("NGROK_ENABLE", "false") !== "true") {
|
|
122
131
|
return;
|
|
123
132
|
}
|
|
124
|
-
const container1 = await
|
|
133
|
+
const container1 = await this.dockerService.getContainer(`ngrok-${project.name}`);
|
|
125
134
|
if (container1) {
|
|
126
135
|
const { State: { Running } } = await container1.inspect();
|
|
127
136
|
if (Running) {
|
|
@@ -131,13 +140,13 @@ class NgrokPlugin extends makes_1.Plugin {
|
|
|
131
140
|
return;
|
|
132
141
|
}
|
|
133
142
|
else {
|
|
134
|
-
await
|
|
143
|
+
await this.dockerService.removeContainer(`ngrok-${project.name}`);
|
|
135
144
|
}
|
|
136
145
|
}
|
|
137
146
|
console.log("Ngrok starting...");
|
|
138
147
|
makes_1.Logger.info(`Ngrok start: ${project.name}`);
|
|
139
|
-
await
|
|
140
|
-
const container = await
|
|
148
|
+
await this.dockerService.pullImage("ngrok/ngrok:latest");
|
|
149
|
+
const container = await this.dockerService.createContainer({
|
|
141
150
|
name: `ngrok-${project.name}`,
|
|
142
151
|
image: "ngrok/ngrok:latest",
|
|
143
152
|
tty: true,
|
|
@@ -182,7 +191,7 @@ class NgrokPlugin extends makes_1.Plugin {
|
|
|
182
191
|
return;
|
|
183
192
|
}
|
|
184
193
|
console.log("Ngrok stopping...");
|
|
185
|
-
await
|
|
194
|
+
await this.dockerService.removeContainer(`ngrok-${project.name}`);
|
|
186
195
|
}
|
|
187
196
|
async start(options) {
|
|
188
197
|
const { name, detach } = options;
|
|
@@ -192,7 +201,7 @@ class NgrokPlugin extends makes_1.Plugin {
|
|
|
192
201
|
const project = await this.projectService.get();
|
|
193
202
|
await this.onProjectStart(project);
|
|
194
203
|
if (!detach) {
|
|
195
|
-
await
|
|
204
|
+
await this.dockerService.attach(`ngrok-${project.name}`);
|
|
196
205
|
}
|
|
197
206
|
}
|
|
198
207
|
async stop(options) {
|
|
@@ -214,7 +223,7 @@ class NgrokPlugin extends makes_1.Plugin {
|
|
|
214
223
|
await this.projectService.cdProject(name);
|
|
215
224
|
}
|
|
216
225
|
const project = await this.projectService.get();
|
|
217
|
-
const container = await
|
|
226
|
+
const container = await this.dockerService.getContainer(`ngrok-${project.name}`);
|
|
218
227
|
if (!container) {
|
|
219
228
|
throw new Error("Ngrok not started");
|
|
220
229
|
}
|
|
@@ -225,7 +234,7 @@ class NgrokPlugin extends makes_1.Plugin {
|
|
|
225
234
|
await this.projectService.cdProject(name);
|
|
226
235
|
}
|
|
227
236
|
const project = await this.projectService.get();
|
|
228
|
-
await
|
|
237
|
+
await this.dockerService.attach(`ngrok-${project.name}`);
|
|
229
238
|
}
|
|
230
239
|
async forwarding(options) {
|
|
231
240
|
const { name } = options;
|
|
@@ -235,5 +244,11 @@ class NgrokPlugin extends makes_1.Plugin {
|
|
|
235
244
|
const project = await this.projectService.get();
|
|
236
245
|
return this.getForwarding(project);
|
|
237
246
|
}
|
|
238
|
-
}
|
|
247
|
+
};
|
|
239
248
|
exports.NgrokPlugin = NgrokPlugin;
|
|
249
|
+
exports.NgrokPlugin = NgrokPlugin = __decorate([
|
|
250
|
+
(0, core_1.Controller)(),
|
|
251
|
+
__metadata("design:paramtypes", [services_1.AppEventsService,
|
|
252
|
+
services_1.ProjectService,
|
|
253
|
+
core_1.DockerService])
|
|
254
|
+
], NgrokPlugin);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Project } from "@wocker/core";
|
|
1
2
|
import { Cli } from "@kearisp/cli";
|
|
2
|
-
import {
|
|
3
|
-
import { AppConfigService, AppEventsService, ProjectService } from "../services";
|
|
3
|
+
import { AppConfigService, AppEventsService, ProjectService, DockerService } from "../services";
|
|
4
4
|
type InitOptions = {};
|
|
5
5
|
type StartOptions = {
|
|
6
6
|
name?: string;
|
|
@@ -14,11 +14,13 @@ type StopOptions = {
|
|
|
14
14
|
type BuildOptions = {
|
|
15
15
|
rebuild?: boolean;
|
|
16
16
|
};
|
|
17
|
-
declare class PageKitePlugin
|
|
18
|
-
protected appConfigService: AppConfigService;
|
|
19
|
-
protected appEventsService: AppEventsService;
|
|
20
|
-
protected projectService: ProjectService;
|
|
21
|
-
|
|
17
|
+
export declare class PageKitePlugin {
|
|
18
|
+
protected readonly appConfigService: AppConfigService;
|
|
19
|
+
protected readonly appEventsService: AppEventsService;
|
|
20
|
+
protected readonly projectService: ProjectService;
|
|
21
|
+
protected readonly dockerService: DockerService;
|
|
22
|
+
constructor(appConfigService: AppConfigService, appEventsService: AppEventsService, projectService: ProjectService, dockerService: DockerService);
|
|
23
|
+
pluginPath(...parts: string[]): string;
|
|
22
24
|
install(cli: Cli): void;
|
|
23
25
|
onProjectStart(project: Project): Promise<void>;
|
|
24
26
|
onProjectStop(project: Project): Promise<void>;
|
|
@@ -27,4 +29,4 @@ declare class PageKitePlugin extends Plugin {
|
|
|
27
29
|
stop(options: StopOptions): Promise<void>;
|
|
28
30
|
build(options?: BuildOptions): Promise<void>;
|
|
29
31
|
}
|
|
30
|
-
export {
|
|
32
|
+
export {};
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.PageKitePlugin = void 0;
|
|
13
|
+
const core_1 = require("@wocker/core");
|
|
4
14
|
const utils_1 = require("@wocker/utils");
|
|
5
|
-
const makes_1 = require("../makes");
|
|
6
|
-
const utils_2 = require("../utils");
|
|
7
15
|
const services_1 = require("../services");
|
|
8
|
-
|
|
9
|
-
constructor(
|
|
10
|
-
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
16
|
+
let PageKitePlugin = class PageKitePlugin {
|
|
17
|
+
constructor(appConfigService, appEventsService, projectService, dockerService) {
|
|
18
|
+
this.appConfigService = appConfigService;
|
|
19
|
+
this.appEventsService = appEventsService;
|
|
20
|
+
this.projectService = projectService;
|
|
21
|
+
this.dockerService = dockerService;
|
|
22
|
+
}
|
|
23
|
+
pluginPath(...parts) {
|
|
24
|
+
return this.appConfigService.pluginsPath("pagekite", ...parts);
|
|
14
25
|
}
|
|
15
26
|
install(cli) {
|
|
16
|
-
super.install(cli);
|
|
17
27
|
this.appEventsService.on("project:start", (project) => this.onProjectStart(project));
|
|
18
28
|
this.appEventsService.on("project:stop", (project) => this.onProjectStop(project));
|
|
19
29
|
cli.command("pagekite:init")
|
|
@@ -51,7 +61,7 @@ class PageKitePlugin extends makes_1.Plugin {
|
|
|
51
61
|
}
|
|
52
62
|
console.info("Pagekite starting...");
|
|
53
63
|
await this.build();
|
|
54
|
-
let container = await
|
|
64
|
+
let container = await this.dockerService.getContainer(`pagekite-${project.name}`);
|
|
55
65
|
if (container) {
|
|
56
66
|
const { State: { Running } } = await container.inspect();
|
|
57
67
|
if (Running) {
|
|
@@ -59,11 +69,11 @@ class PageKitePlugin extends makes_1.Plugin {
|
|
|
59
69
|
return;
|
|
60
70
|
}
|
|
61
71
|
else {
|
|
62
|
-
await
|
|
72
|
+
await this.dockerService.removeContainer(`pagekite-${project.name}`);
|
|
63
73
|
}
|
|
64
74
|
}
|
|
65
75
|
const subdomain = project.getEnv("PAGEKITE_SUBDOMAIN");
|
|
66
|
-
container = await
|
|
76
|
+
container = await this.dockerService.createContainer({
|
|
67
77
|
name: `pagekite-${project.name}`,
|
|
68
78
|
image: "ws-pagekite",
|
|
69
79
|
tty: true,
|
|
@@ -93,14 +103,14 @@ class PageKitePlugin extends makes_1.Plugin {
|
|
|
93
103
|
stream.end();
|
|
94
104
|
}
|
|
95
105
|
});
|
|
96
|
-
await
|
|
106
|
+
await this.dockerService.attachStream(stream);
|
|
97
107
|
}
|
|
98
108
|
async onProjectStop(project) {
|
|
99
109
|
if (!project || project.getEnv("PAGEKITE_ENABLE", "false") !== "true") {
|
|
100
110
|
return;
|
|
101
111
|
}
|
|
102
112
|
console.info("Pagekite stopping...");
|
|
103
|
-
await
|
|
113
|
+
await this.dockerService.removeContainer(`pagekite-${project.name}`);
|
|
104
114
|
}
|
|
105
115
|
async init(options) {
|
|
106
116
|
const project = await this.projectService.get();
|
|
@@ -130,7 +140,7 @@ class PageKitePlugin extends makes_1.Plugin {
|
|
|
130
140
|
}
|
|
131
141
|
const project = await this.projectService.get();
|
|
132
142
|
if (restart) {
|
|
133
|
-
await
|
|
143
|
+
await this.dockerService.removeContainer(`pagekite-${project.name}`);
|
|
134
144
|
}
|
|
135
145
|
await this.onProjectStart(project);
|
|
136
146
|
}
|
|
@@ -144,18 +154,24 @@ class PageKitePlugin extends makes_1.Plugin {
|
|
|
144
154
|
}
|
|
145
155
|
async build(options = {}) {
|
|
146
156
|
const { rebuild } = options;
|
|
147
|
-
const exists = await
|
|
157
|
+
const exists = await this.dockerService.imageExists("ws-pagekite");
|
|
148
158
|
if (rebuild) {
|
|
149
|
-
await
|
|
159
|
+
await this.dockerService.removeContainer("ws-pagekite");
|
|
150
160
|
}
|
|
151
161
|
if (!exists || rebuild) {
|
|
152
|
-
|
|
162
|
+
await this.dockerService.buildImage({
|
|
153
163
|
tag: "ws-pagekite",
|
|
154
164
|
context: this.pluginPath(),
|
|
155
165
|
src: "./Dockerfile"
|
|
156
166
|
});
|
|
157
|
-
await (0, utils_2.followProgress)(stream);
|
|
158
167
|
}
|
|
159
168
|
}
|
|
160
|
-
}
|
|
169
|
+
};
|
|
161
170
|
exports.PageKitePlugin = PageKitePlugin;
|
|
171
|
+
exports.PageKitePlugin = PageKitePlugin = __decorate([
|
|
172
|
+
(0, core_1.Controller)(),
|
|
173
|
+
__metadata("design:paramtypes", [services_1.AppConfigService,
|
|
174
|
+
services_1.AppEventsService,
|
|
175
|
+
services_1.ProjectService,
|
|
176
|
+
services_1.DockerService])
|
|
177
|
+
], PageKitePlugin);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare class ProxmoxPlugin
|
|
1
|
+
import { FSManager } from "@wocker/core";
|
|
2
|
+
import { AppConfigService, DockerService } from "../services";
|
|
3
|
+
export declare class ProxmoxPlugin {
|
|
4
|
+
protected readonly appConfigService: AppConfigService;
|
|
5
|
+
protected readonly dockerService: DockerService;
|
|
4
6
|
protected configDir: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
protected fs: FSManager;
|
|
8
|
+
constructor(appConfigService: AppConfigService, dockerService: DockerService);
|
|
9
|
+
pluginPath(...parts: string[]): string;
|
|
7
10
|
up(): Promise<void>;
|
|
8
11
|
down(): Promise<void>;
|
|
9
12
|
}
|
|
@@ -15,6 +15,12 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
18
24
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
25
|
if (mod && mod.__esModule) return mod;
|
|
20
26
|
var result = {};
|
|
@@ -22,21 +28,26 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
28
|
__setModuleDefault(result, mod);
|
|
23
29
|
return result;
|
|
24
30
|
};
|
|
31
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
32
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
33
|
+
};
|
|
25
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
35
|
exports.ProxmoxPlugin = void 0;
|
|
36
|
+
const core_1 = require("@wocker/core");
|
|
27
37
|
const Path = __importStar(require("path"));
|
|
28
|
-
const
|
|
38
|
+
const services_1 = require("../services");
|
|
29
39
|
const utils_1 = require("../utils");
|
|
30
|
-
|
|
31
|
-
constructor() {
|
|
32
|
-
|
|
33
|
-
this.
|
|
40
|
+
let ProxmoxPlugin = class ProxmoxPlugin {
|
|
41
|
+
constructor(appConfigService, dockerService) {
|
|
42
|
+
this.appConfigService = appConfigService;
|
|
43
|
+
this.dockerService = dockerService;
|
|
44
|
+
this.configDir = this.appConfigService.dataPath("plugins/proxmox");
|
|
34
45
|
}
|
|
35
|
-
|
|
36
|
-
|
|
46
|
+
pluginPath(...parts) {
|
|
47
|
+
return Path.join(this.appConfigService.pluginsPath("proxmox"), ...parts);
|
|
37
48
|
}
|
|
38
49
|
async up() {
|
|
39
|
-
const container = await
|
|
50
|
+
const container = await this.dockerService.getContainer("proxmox.workspace");
|
|
40
51
|
if (container) {
|
|
41
52
|
await this.down();
|
|
42
53
|
}
|
|
@@ -63,5 +74,10 @@ class ProxmoxPlugin extends makes_1.Plugin {
|
|
|
63
74
|
await (0, utils_1.exec)("docker image rm ws-proxmox").catch(() => {
|
|
64
75
|
});
|
|
65
76
|
}
|
|
66
|
-
}
|
|
77
|
+
};
|
|
67
78
|
exports.ProxmoxPlugin = ProxmoxPlugin;
|
|
79
|
+
exports.ProxmoxPlugin = ProxmoxPlugin = __decorate([
|
|
80
|
+
(0, core_1.Controller)(),
|
|
81
|
+
__metadata("design:paramtypes", [services_1.AppConfigService,
|
|
82
|
+
services_1.DockerService])
|
|
83
|
+
], ProxmoxPlugin);
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { FSManager } from "@wocker/core";
|
|
2
2
|
import { Cli } from "@kearisp/cli";
|
|
3
|
-
import { DI, Plugin } from "../makes";
|
|
4
3
|
import { AppConfigService, DockerService } from "../services";
|
|
5
|
-
declare class RedisPlugin
|
|
4
|
+
export declare class RedisPlugin {
|
|
5
|
+
protected readonly appConfigService: AppConfigService;
|
|
6
|
+
protected readonly dockerService: DockerService;
|
|
6
7
|
protected container: string;
|
|
7
8
|
protected commander: string;
|
|
8
|
-
protected appConfigService: AppConfigService;
|
|
9
|
-
protected dockerService: DockerService;
|
|
10
9
|
protected fs: FSManager;
|
|
11
|
-
constructor(
|
|
10
|
+
constructor(appConfigService: AppConfigService, dockerService: DockerService);
|
|
12
11
|
install(cli: Cli): void;
|
|
13
12
|
up(): Promise<void>;
|
|
14
13
|
protected startCommander(): Promise<void>;
|
|
15
14
|
down(): Promise<void>;
|
|
16
15
|
protected stopCommander(): Promise<void>;
|
|
17
16
|
}
|
|
18
|
-
export { RedisPlugin };
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.RedisPlugin = void 0;
|
|
4
13
|
const core_1 = require("@wocker/core");
|
|
5
|
-
const makes_1 = require("../makes");
|
|
6
14
|
const services_1 = require("../services");
|
|
7
|
-
|
|
8
|
-
constructor(
|
|
9
|
-
|
|
15
|
+
let RedisPlugin = class RedisPlugin {
|
|
16
|
+
constructor(appConfigService, dockerService) {
|
|
17
|
+
this.appConfigService = appConfigService;
|
|
18
|
+
this.dockerService = dockerService;
|
|
10
19
|
this.container = "redis.workspace";
|
|
11
20
|
this.commander = "redis-commander.workspace";
|
|
12
|
-
this.appConfigService = di.resolveService(services_1.AppConfigService);
|
|
13
|
-
this.dockerService = di.resolveService(services_1.DockerService);
|
|
14
21
|
this.fs = new core_1.FSManager(this.appConfigService.pluginsPath("redis"), this.appConfigService.dataPath("plugins/redis"));
|
|
15
22
|
}
|
|
16
23
|
install(cli) {
|
|
17
|
-
super.install(cli);
|
|
18
24
|
cli.command("redis:start")
|
|
19
25
|
.action(() => this.up());
|
|
20
26
|
cli.command("redis:stop")
|
|
@@ -76,5 +82,10 @@ class RedisPlugin extends makes_1.Plugin {
|
|
|
76
82
|
console.info("RedisCommander stopping...");
|
|
77
83
|
await this.dockerService.removeContainer(this.commander);
|
|
78
84
|
}
|
|
79
|
-
}
|
|
85
|
+
};
|
|
80
86
|
exports.RedisPlugin = RedisPlugin;
|
|
87
|
+
exports.RedisPlugin = RedisPlugin = __decorate([
|
|
88
|
+
(0, core_1.Controller)(),
|
|
89
|
+
__metadata("design:paramtypes", [services_1.AppConfigService,
|
|
90
|
+
services_1.DockerService])
|
|
91
|
+
], RedisPlugin);
|
package/lib/plugins/index.d.ts
CHANGED
|
@@ -4,7 +4,5 @@ export * from "./MaildevPlugin";
|
|
|
4
4
|
export * from "./MongodbPlugin";
|
|
5
5
|
export * from "./NgrokPlugin";
|
|
6
6
|
export * from "./PageKitePlugin";
|
|
7
|
-
export * from "./PostgresPlugin";
|
|
8
|
-
export * from "./PostgresPlugin";
|
|
9
7
|
export * from "./ProxmoxPlugin";
|
|
10
8
|
export * from "./RedisPlugin";
|
package/lib/plugins/index.js
CHANGED
|
@@ -20,7 +20,5 @@ __exportStar(require("./MaildevPlugin"), exports);
|
|
|
20
20
|
__exportStar(require("./MongodbPlugin"), exports);
|
|
21
21
|
__exportStar(require("./NgrokPlugin"), exports);
|
|
22
22
|
__exportStar(require("./PageKitePlugin"), exports);
|
|
23
|
-
__exportStar(require("./PostgresPlugin"), exports);
|
|
24
|
-
__exportStar(require("./PostgresPlugin"), exports);
|
|
25
23
|
__exportStar(require("./ProxmoxPlugin"), exports);
|
|
26
24
|
__exportStar(require("./RedisPlugin"), exports);
|
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
import { Config,
|
|
1
|
+
import { Config, AppConfigService as CoreAppConfigService } from "@wocker/core";
|
|
2
2
|
type TypeMap = {
|
|
3
3
|
[type: string]: string;
|
|
4
4
|
};
|
|
5
|
-
declare class AppConfigService {
|
|
5
|
+
export declare class AppConfigService extends CoreAppConfigService {
|
|
6
6
|
protected pwd: string;
|
|
7
7
|
protected mapTypes: TypeMap;
|
|
8
8
|
constructor();
|
|
9
|
-
dataPath(...
|
|
10
|
-
pluginsPath(...
|
|
9
|
+
dataPath(...parts: string[]): string;
|
|
10
|
+
pluginsPath(...parts: string[]): string;
|
|
11
|
+
presetPath(...parts: string[]): string;
|
|
11
12
|
getPWD(): string;
|
|
12
13
|
setPWD(pwd: string): void;
|
|
13
|
-
getAppConfig(): Promise<Config>;
|
|
14
|
-
private saveAppConfig;
|
|
15
|
-
getMeta(name: string, defaultValue?: string): Promise<string>;
|
|
16
|
-
setMeta(name: string, value?: string | number): Promise<void>;
|
|
17
|
-
getAllEnvVariables(): Promise<EnvConfig>;
|
|
18
|
-
getEnvVariable(name: string, defaultValue?: string): Promise<string>;
|
|
19
|
-
setEnv(env: any): Promise<void>;
|
|
20
|
-
setEnvVariable(name: string, value: string | number): Promise<void>;
|
|
21
|
-
unsetEnv(...keys: string[]): Promise<void>;
|
|
22
14
|
getProjectTypes(): TypeMap;
|
|
23
15
|
registerProjectType(name: string, title?: string): void;
|
|
24
|
-
|
|
25
|
-
activatePlugin(name: string): Promise<void>;
|
|
26
|
-
deactivatePlugin(name: string): Promise<void>;
|
|
16
|
+
protected loadConfig(): Promise<Config>;
|
|
27
17
|
}
|
|
28
|
-
export {
|
|
18
|
+
export {};
|