@wocker/ws 1.0.2 → 1.0.4
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/App.d.ts +4 -3
- package/lib/App.js +98 -77
- package/lib/controllers/ImageController.d.ts +2 -2
- package/lib/controllers/ImageController.js +27 -27
- package/lib/controllers/PluginController.d.ts +2 -2
- package/lib/controllers/PluginController.js +78 -56
- package/lib/controllers/PresetController.d.ts +3 -1
- package/lib/controllers/PresetController.js +155 -136
- package/lib/controllers/ProjectController.d.ts +5 -5
- package/lib/controllers/ProjectController.js +653 -603
- package/lib/controllers/ProxyController.d.ts +4 -1
- package/lib/controllers/ProxyController.js +269 -245
- package/lib/controllers/index.js +19 -58
- package/lib/decorators/Inject.d.ts +1 -0
- package/lib/decorators/Inject.js +8 -0
- package/lib/decorators/Injectable.d.ts +4 -0
- package/lib/decorators/Injectable.js +17 -0
- package/lib/decorators/index.d.ts +1 -0
- package/lib/decorators/index.js +17 -0
- package/lib/env.js +33 -15
- package/lib/index.d.ts +3 -0
- package/lib/index.js +31 -16
- package/lib/makes/Controller.js +4 -8
- package/lib/makes/DI.d.ts +7 -0
- package/lib/makes/DI.js +27 -0
- package/lib/makes/Docker.js +298 -382
- package/lib/makes/FS.d.ts +3 -9
- package/lib/makes/FS.js +277 -305
- package/lib/makes/LineConvertStream.js +37 -40
- package/lib/makes/Logger.d.ts +9 -1
- package/lib/makes/Logger.js +22 -11
- package/lib/makes/Model.js +8 -12
- package/lib/makes/MySQL.js +6 -27
- package/lib/makes/Plugin.d.ts +1 -1
- package/lib/makes/Plugin.js +55 -37
- package/lib/makes/Preset.d.ts +46 -0
- package/lib/makes/Preset.js +33 -0
- package/lib/makes/Project.d.ts +45 -0
- package/lib/makes/Project.js +127 -0
- package/lib/makes/Repository.js +18 -21
- package/lib/makes/index.d.ts +3 -0
- package/lib/makes/index.js +23 -69
- package/lib/plugins/ElasticSearchPlugin.d.ts +3 -1
- package/lib/plugins/ElasticSearchPlugin.js +66 -66
- package/lib/plugins/LocaltunnelPlugin.d.ts +2 -2
- package/lib/plugins/LocaltunnelPlugin.js +256 -257
- package/lib/plugins/MaildevPlugin.d.ts +2 -2
- package/lib/plugins/MaildevPlugin.js +45 -44
- package/lib/plugins/MongodbPlugin.d.ts +2 -2
- package/lib/plugins/MongodbPlugin.js +303 -248
- package/lib/plugins/NgrokPlugin.d.ts +2 -2
- package/lib/plugins/NgrokPlugin.js +221 -231
- package/lib/plugins/PageKitePlugin.d.ts +2 -2
- package/lib/plugins/PageKitePlugin.js +150 -149
- package/lib/plugins/PostgresPlugin.d.ts +1 -1
- package/lib/plugins/PostgresPlugin.js +115 -89
- package/lib/plugins/ProxmoxPlugin.d.ts +1 -1
- package/lib/plugins/ProxmoxPlugin.js +50 -38
- package/lib/plugins/RedisPlugin.d.ts +3 -1
- package/lib/plugins/RedisPlugin.js +73 -72
- package/lib/plugins/index.js +25 -103
- package/lib/services/AppConfigService.d.ts +3 -3
- package/lib/services/AppConfigService.js +162 -157
- package/lib/services/AppEventsService.js +26 -24
- package/lib/services/DockerService.d.ts +37 -2
- package/lib/services/DockerService.js +185 -205
- package/lib/services/LogService.d.ts +3 -2
- package/lib/services/LogService.js +33 -34
- package/lib/services/PluginService.d.ts +2 -1
- package/lib/services/PluginService.js +11 -14
- package/lib/services/PresetService.d.ts +8 -3
- package/lib/services/PresetService.js +60 -59
- package/lib/services/ProjectService.d.ts +11 -4
- package/lib/services/ProjectService.js +140 -129
- package/lib/services/index.js +21 -80
- package/lib/types/Config.d.ts +4 -3
- package/lib/types/Config.js +1 -4
- package/lib/types/EnvConfig.js +1 -4
- package/lib/types/index.js +16 -25
- package/lib/utils/buildOptions.js +5 -8
- package/lib/utils/demuxOutput.js +16 -20
- package/lib/utils/escapeRegExp.js +4 -7
- package/lib/utils/exec.js +38 -39
- package/lib/utils/fetch.js +46 -30
- package/lib/utils/followProgress.js +66 -77
- package/lib/utils/format-size-units.js +16 -16
- package/lib/utils/get-config.d.ts +1 -1
- package/lib/utils/get-config.js +13 -16
- package/lib/utils/get-cursor-position.js +22 -29
- package/lib/utils/image-build.js +35 -23
- package/lib/utils/index.js +32 -191
- package/lib/utils/injectVariables.js +10 -13
- package/lib/utils/parse-table.js +20 -23
- package/lib/utils/set-config.d.ts +1 -1
- package/lib/utils/set-config.js +12 -15
- package/lib/utils/spawn.js +17 -20
- package/lib/utils/tty.js +2 -6
- package/lib/utils/volumeFormat.js +5 -12
- package/lib/utils/volumeParse.js +10 -13
- package/package.json +13 -39
- package/presets/bun/Dockerfile +11 -0
- package/presets/bun/config.json +3 -0
- package/presets/node/Dockerfile +4 -2
- package/presets/php-apache/Dockerfile +3 -2
- package/.github/workflows/publish.yml +0 -31
- package/plugins/mariadb/admin/conf/config.user.inc.php +0 -9
|
@@ -1,249 +1,239 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.NgrokPlugin = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class NgrokPlugin extends
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
install(cli) {
|
|
17
|
-
super.install(cli);
|
|
18
|
-
this.appEventsService.on("project:start", project => this.onProjectStart(project));
|
|
19
|
-
this.appEventsService.on("project:stop", project => this.onProjectStop(project));
|
|
20
|
-
cli.command("ngrok:init").option("name", {
|
|
21
|
-
alias: "n",
|
|
22
|
-
type: "string",
|
|
23
|
-
description: "Project name"
|
|
24
|
-
}).action(options => this.init(options));
|
|
25
|
-
cli.command("ngrok:start").option("name", {
|
|
26
|
-
type: "string",
|
|
27
|
-
alias: "n",
|
|
28
|
-
description: "Project name"
|
|
29
|
-
}).option("detach", {
|
|
30
|
-
type: "boolean",
|
|
31
|
-
alias: "d",
|
|
32
|
-
description: "Detach"
|
|
33
|
-
}).action(options => this.start(options));
|
|
34
|
-
cli.command("ngrok:stop").option("name", {
|
|
35
|
-
type: "string",
|
|
36
|
-
alias: "n",
|
|
37
|
-
description: "Project name"
|
|
38
|
-
}).action(options => this.stop(options));
|
|
39
|
-
cli.command("ngrok:restart").option("name", {
|
|
40
|
-
type: "string",
|
|
41
|
-
alias: "n",
|
|
42
|
-
description: "Project name"
|
|
43
|
-
}).option("detach", {
|
|
44
|
-
type: "boolean",
|
|
45
|
-
alias: "d",
|
|
46
|
-
description: "Detach"
|
|
47
|
-
}).action(options => this.restart(options));
|
|
48
|
-
cli.command("ngrok:logs").option("name", {
|
|
49
|
-
type: "string",
|
|
50
|
-
alias: "n",
|
|
51
|
-
description: "Project name"
|
|
52
|
-
}).action(options => this.logs(options));
|
|
53
|
-
cli.command("ngrok:attach").option("name", {
|
|
54
|
-
type: "string",
|
|
55
|
-
alias: "n",
|
|
56
|
-
description: "Project name"
|
|
57
|
-
}).action(options => this.attach(options));
|
|
58
|
-
cli.command("ngrok:forwarding").option("name", {
|
|
59
|
-
type: "string",
|
|
60
|
-
alias: "n",
|
|
61
|
-
description: "Project name"
|
|
62
|
-
}).action(options => this.forwarding(options));
|
|
63
|
-
}
|
|
64
|
-
async init(options) {
|
|
65
|
-
const {
|
|
66
|
-
name
|
|
67
|
-
} = options;
|
|
68
|
-
if (name) {
|
|
69
|
-
await this.projectService.cdProject(name);
|
|
4
|
+
const utils_1 = require("@wocker/utils");
|
|
5
|
+
const makes_1 = require("../makes");
|
|
6
|
+
const services_1 = require("../services");
|
|
7
|
+
class NgrokPlugin extends makes_1.Plugin {
|
|
8
|
+
constructor(di) {
|
|
9
|
+
super("ngrok");
|
|
10
|
+
this.appEventsService = di.resolveService(services_1.AppEventsService);
|
|
11
|
+
this.projectService = di.resolveService(services_1.ProjectService);
|
|
70
12
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
13
|
+
install(cli) {
|
|
14
|
+
super.install(cli);
|
|
15
|
+
this.appEventsService.on("project:start", (project) => this.onProjectStart(project));
|
|
16
|
+
this.appEventsService.on("project:stop", (project) => this.onProjectStop(project));
|
|
17
|
+
cli.command("ngrok:init")
|
|
18
|
+
.option("name", {
|
|
19
|
+
alias: "n",
|
|
20
|
+
type: "string",
|
|
21
|
+
description: "Project name"
|
|
22
|
+
})
|
|
23
|
+
.action((options) => this.init(options));
|
|
24
|
+
cli.command("ngrok:start")
|
|
25
|
+
.option("name", {
|
|
26
|
+
type: "string",
|
|
27
|
+
alias: "n",
|
|
28
|
+
description: "Project name"
|
|
29
|
+
})
|
|
30
|
+
.option("detach", {
|
|
31
|
+
type: "boolean",
|
|
32
|
+
alias: "d",
|
|
33
|
+
description: "Detach"
|
|
34
|
+
})
|
|
35
|
+
.action((options) => this.start(options));
|
|
36
|
+
cli.command("ngrok:stop")
|
|
37
|
+
.option("name", {
|
|
38
|
+
type: "string",
|
|
39
|
+
alias: "n",
|
|
40
|
+
description: "Project name"
|
|
41
|
+
})
|
|
42
|
+
.action((options) => this.stop(options));
|
|
43
|
+
cli.command("ngrok:restart")
|
|
44
|
+
.option("name", {
|
|
45
|
+
type: "string",
|
|
46
|
+
alias: "n",
|
|
47
|
+
description: "Project name"
|
|
48
|
+
})
|
|
49
|
+
.option("detach", {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
alias: "d",
|
|
52
|
+
description: "Detach"
|
|
53
|
+
})
|
|
54
|
+
.action((options) => this.restart(options));
|
|
55
|
+
cli.command("ngrok:logs")
|
|
56
|
+
.option("name", {
|
|
57
|
+
type: "string",
|
|
58
|
+
alias: "n",
|
|
59
|
+
description: "Project name"
|
|
60
|
+
})
|
|
61
|
+
.action((options) => this.logs(options));
|
|
62
|
+
cli.command("ngrok:attach")
|
|
63
|
+
.option("name", {
|
|
64
|
+
type: "string",
|
|
65
|
+
alias: "n",
|
|
66
|
+
description: "Project name"
|
|
67
|
+
})
|
|
68
|
+
.action((options) => this.attach(options));
|
|
69
|
+
cli.command("ngrok:forwarding")
|
|
70
|
+
.option("name", {
|
|
71
|
+
type: "string",
|
|
72
|
+
alias: "n",
|
|
73
|
+
description: "Project name"
|
|
74
|
+
})
|
|
75
|
+
.action((options) => this.forwarding(options));
|
|
85
76
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
77
|
+
async init(options) {
|
|
78
|
+
const { name } = options;
|
|
79
|
+
if (name) {
|
|
80
|
+
await this.projectService.cdProject(name);
|
|
81
|
+
}
|
|
82
|
+
const project = await this.projectService.get();
|
|
83
|
+
const enable = await (0, utils_1.promptConfirm)({
|
|
84
|
+
message: "Enable ngrok?",
|
|
85
|
+
default: true
|
|
86
|
+
});
|
|
87
|
+
if (enable) {
|
|
88
|
+
const token = await (0, utils_1.promptText)({
|
|
89
|
+
message: "Token",
|
|
90
|
+
default: project.getEnv("NGROK_AUTHTOKEN")
|
|
91
|
+
});
|
|
92
|
+
project.setEnv("NGROK_AUTHTOKEN", token);
|
|
93
|
+
project.setEnv("NGROK_ENABLE", "true");
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
project.setEnv("NGROK_ENABLE", "false");
|
|
97
97
|
}
|
|
98
|
-
|
|
99
|
-
} = await container.inspect();
|
|
100
|
-
const stream = await _makes.Docker.exec("proxy.workspace", ["curl", `http://${workspace.IPAddress}:4040/api/tunnels/command_line`], false);
|
|
101
|
-
const res = await new Promise((resolve, reject) => {
|
|
102
|
-
let res = "";
|
|
103
|
-
stream.on("data", data => {
|
|
104
|
-
res += (0, _utils.demuxOutput)(data).toString();
|
|
105
|
-
});
|
|
106
|
-
stream.on("end", () => resolve(res));
|
|
107
|
-
stream.on("error", reject);
|
|
108
|
-
});
|
|
109
|
-
const tunnel = JSON.parse(res);
|
|
110
|
-
return tunnel.public_url;
|
|
111
|
-
}
|
|
112
|
-
async onProjectStart(project) {
|
|
113
|
-
if (!project || project.getEnv("NGROK_ENABLE", "false") !== "true") {
|
|
114
|
-
return;
|
|
98
|
+
await project.save();
|
|
115
99
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Running
|
|
100
|
+
async getForwarding(project) {
|
|
101
|
+
const container = await makes_1.Docker.getContainer(`ngrok-${project.name}`);
|
|
102
|
+
if (!container) {
|
|
103
|
+
throw new Error(`Ngrok for "${project.name}" not started`);
|
|
121
104
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
105
|
+
const { NetworkSettings: { Networks: { workspace } } } = await container.inspect();
|
|
106
|
+
const stream = await makes_1.Docker.exec("proxy.workspace", [
|
|
107
|
+
"curl", `http://${workspace.IPAddress}:4040/api/tunnels/command_line`
|
|
108
|
+
], false);
|
|
109
|
+
const res = await new Promise((resolve, reject) => {
|
|
110
|
+
let res = "";
|
|
111
|
+
stream.on("data", (data) => {
|
|
112
|
+
res += (0, utils_1.demuxOutput)(data).toString();
|
|
113
|
+
});
|
|
114
|
+
stream.on("end", () => resolve(res));
|
|
115
|
+
stream.on("error", reject);
|
|
116
|
+
});
|
|
117
|
+
const tunnel = JSON.parse(res);
|
|
118
|
+
return tunnel.public_url;
|
|
131
119
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const container = await _makes.Docker.createContainer({
|
|
136
|
-
name: `ngrok-${project.name}`,
|
|
137
|
-
image: "ngrok/ngrok:latest",
|
|
138
|
-
tty: true,
|
|
139
|
-
restart: "always",
|
|
140
|
-
env: {
|
|
141
|
-
NGROK_AUTHTOKEN: project.getEnv("NGROK_AUTHTOKEN")
|
|
142
|
-
},
|
|
143
|
-
cmd: ["http", `${project.name}.workspace:80`]
|
|
144
|
-
});
|
|
145
|
-
const stream = await container.attach({
|
|
146
|
-
logs: true,
|
|
147
|
-
stream: true,
|
|
148
|
-
hijack: true,
|
|
149
|
-
stdin: true,
|
|
150
|
-
stdout: true,
|
|
151
|
-
stderr: true
|
|
152
|
-
});
|
|
153
|
-
stream.setEncoding("utf8");
|
|
154
|
-
await container.start();
|
|
155
|
-
await container.resize({
|
|
156
|
-
w: 90,
|
|
157
|
-
h: 40
|
|
158
|
-
});
|
|
159
|
-
await new Promise((resolve, reject) => {
|
|
160
|
-
stream.on("data", data => {
|
|
161
|
-
const regLink = /(https?):\/\/(\w[\w.-]+[a-z]|\d+\.\d+\.\d+\.\d+)(?::(\d+))?/;
|
|
162
|
-
if (regLink.test(data.toString())) {
|
|
163
|
-
const [link] = regLink.exec(data.toString());
|
|
164
|
-
if (link.includes(".ngrok")) {
|
|
165
|
-
_core.Logger.info(`${project.name} forwarding: ${link}`);
|
|
166
|
-
console.log(`Forwarding: ${link}`);
|
|
167
|
-
stream.end();
|
|
168
|
-
}
|
|
120
|
+
async onProjectStart(project) {
|
|
121
|
+
if (!project || project.getEnv("NGROK_ENABLE", "false") !== "true") {
|
|
122
|
+
return;
|
|
169
123
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
124
|
+
const container1 = await makes_1.Docker.getContainer(`ngrok-${project.name}`);
|
|
125
|
+
if (container1) {
|
|
126
|
+
const { State: { Running } } = await container1.inspect();
|
|
127
|
+
if (Running) {
|
|
128
|
+
console.log("Ngrok is already running");
|
|
129
|
+
const forwarding = await this.getForwarding(project);
|
|
130
|
+
console.log(`Forwarding: ${forwarding}`);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
await makes_1.Docker.removeContainer(`ngrok-${project.name}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
console.log("Ngrok starting...");
|
|
138
|
+
makes_1.Logger.info(`Ngrok start: ${project.name}`);
|
|
139
|
+
await makes_1.Docker.pullImage("ngrok/ngrok:latest");
|
|
140
|
+
const container = await makes_1.Docker.createContainer({
|
|
141
|
+
name: `ngrok-${project.name}`,
|
|
142
|
+
image: "ngrok/ngrok:latest",
|
|
143
|
+
tty: true,
|
|
144
|
+
restart: "always",
|
|
145
|
+
env: {
|
|
146
|
+
NGROK_AUTHTOKEN: project.getEnv("NGROK_AUTHTOKEN")
|
|
147
|
+
},
|
|
148
|
+
cmd: ["http", `${project.name}.workspace:80`]
|
|
149
|
+
});
|
|
150
|
+
const stream = await container.attach({
|
|
151
|
+
logs: true,
|
|
152
|
+
stream: true,
|
|
153
|
+
hijack: true,
|
|
154
|
+
stdin: true,
|
|
155
|
+
stdout: true,
|
|
156
|
+
stderr: true
|
|
157
|
+
});
|
|
158
|
+
stream.setEncoding("utf8");
|
|
159
|
+
await container.start();
|
|
160
|
+
await container.resize({
|
|
161
|
+
w: 90,
|
|
162
|
+
h: 40
|
|
163
|
+
});
|
|
164
|
+
await new Promise((resolve, reject) => {
|
|
165
|
+
stream.on("data", (data) => {
|
|
166
|
+
const regLink = /(https?):\/\/(\w[\w.-]+[a-z]|\d+\.\d+\.\d+\.\d+)(?::(\d+))?/;
|
|
167
|
+
if (regLink.test(data.toString())) {
|
|
168
|
+
const [link] = regLink.exec(data.toString());
|
|
169
|
+
if (link.includes(".ngrok")) {
|
|
170
|
+
makes_1.Logger.info(`${project.name} forwarding: ${link}`);
|
|
171
|
+
console.log(`Forwarding: ${link}`);
|
|
172
|
+
stream.end();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
stream.on("end", resolve);
|
|
177
|
+
stream.on("error", reject);
|
|
178
|
+
});
|
|
178
179
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
detach
|
|
186
|
-
} = options;
|
|
187
|
-
if (name) {
|
|
188
|
-
await this.projectService.cdProject(name);
|
|
180
|
+
async onProjectStop(project) {
|
|
181
|
+
if (!project || project.getEnv("NGROK_ENABLE", "false") !== "true") {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
console.log("Ngrok stopping...");
|
|
185
|
+
await makes_1.Docker.removeContainer(`ngrok-${project.name}`);
|
|
189
186
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
187
|
+
async start(options) {
|
|
188
|
+
const { name, detach } = options;
|
|
189
|
+
if (name) {
|
|
190
|
+
await this.projectService.cdProject(name);
|
|
191
|
+
}
|
|
192
|
+
const project = await this.projectService.get();
|
|
193
|
+
await this.onProjectStart(project);
|
|
194
|
+
if (!detach) {
|
|
195
|
+
await makes_1.Docker.attach(`ngrok-${project.name}`);
|
|
196
|
+
}
|
|
194
197
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
198
|
+
async stop(options) {
|
|
199
|
+
const { name } = options;
|
|
200
|
+
if (name) {
|
|
201
|
+
await this.projectService.cdProject(name);
|
|
202
|
+
}
|
|
203
|
+
const project = await this.projectService.get();
|
|
204
|
+
await this.onProjectStop(project);
|
|
202
205
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
const {
|
|
208
|
-
name
|
|
209
|
-
} = options;
|
|
210
|
-
await this.stop({
|
|
211
|
-
name
|
|
212
|
-
});
|
|
213
|
-
await this.start(options);
|
|
214
|
-
}
|
|
215
|
-
async logs(options) {
|
|
216
|
-
const {
|
|
217
|
-
name
|
|
218
|
-
} = options;
|
|
219
|
-
if (name) {
|
|
220
|
-
await this.projectService.cdProject(name);
|
|
206
|
+
async restart(options) {
|
|
207
|
+
const { name } = options;
|
|
208
|
+
await this.stop({ name });
|
|
209
|
+
await this.start(options);
|
|
221
210
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
211
|
+
async logs(options) {
|
|
212
|
+
const { name } = options;
|
|
213
|
+
if (name) {
|
|
214
|
+
await this.projectService.cdProject(name);
|
|
215
|
+
}
|
|
216
|
+
const project = await this.projectService.get();
|
|
217
|
+
const container = await makes_1.Docker.getContainer(`ngrok-${project.name}`);
|
|
218
|
+
if (!container) {
|
|
219
|
+
throw new Error("Ngrok not started");
|
|
220
|
+
}
|
|
226
221
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
222
|
+
async attach(options) {
|
|
223
|
+
const { name } = options;
|
|
224
|
+
if (name) {
|
|
225
|
+
await this.projectService.cdProject(name);
|
|
226
|
+
}
|
|
227
|
+
const project = await this.projectService.get();
|
|
228
|
+
await makes_1.Docker.attach(`ngrok-${project.name}`);
|
|
234
229
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (name) {
|
|
243
|
-
await this.projectService.cdProject(name);
|
|
230
|
+
async forwarding(options) {
|
|
231
|
+
const { name } = options;
|
|
232
|
+
if (name) {
|
|
233
|
+
await this.projectService.cdProject(name);
|
|
234
|
+
}
|
|
235
|
+
const project = await this.projectService.get();
|
|
236
|
+
return this.getForwarding(project);
|
|
244
237
|
}
|
|
245
|
-
const project = await this.projectService.get();
|
|
246
|
-
return this.getForwarding(project);
|
|
247
|
-
}
|
|
248
238
|
}
|
|
249
|
-
exports.NgrokPlugin = NgrokPlugin;
|
|
239
|
+
exports.NgrokPlugin = NgrokPlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DI, AppConfigService, AppEventsService, ProjectService, Project } from "@wocker/core";
|
|
2
1
|
import { Cli } from "@kearisp/cli";
|
|
3
|
-
import { Plugin } from "
|
|
2
|
+
import { DI, Plugin, Project } from "../makes";
|
|
3
|
+
import { AppConfigService, AppEventsService, ProjectService } from "../services";
|
|
4
4
|
type InitOptions = {};
|
|
5
5
|
type StartOptions = {
|
|
6
6
|
name?: string;
|