@wocker/ws 1.0.1 → 1.0.3
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 +11 -137
- package/bin/ws.js +7 -3
- package/lib/App.d.ts +10 -7
- package/lib/App.js +99 -44
- package/lib/controllers/ImageController.d.ts +4 -2
- package/lib/controllers/ImageController.js +27 -25
- package/lib/controllers/PluginController.d.ts +14 -0
- package/lib/controllers/PluginController.js +84 -0
- package/lib/controllers/PresetController.d.ts +21 -0
- package/lib/controllers/PresetController.js +169 -0
- package/lib/controllers/ProjectController.d.ts +11 -3
- package/lib/controllers/ProjectController.js +653 -536
- package/lib/{plugins/ProxyPlugin.d.ts → controllers/ProxyController.d.ts} +12 -11
- package/lib/controllers/ProxyController.js +273 -0
- package/lib/controllers/index.d.ts +3 -0
- package/lib/controllers/index.js +19 -25
- package/lib/env.js +33 -22
- package/lib/index.d.ts +2 -0
- package/lib/index.js +29 -28
- 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 +299 -397
- package/lib/makes/FS.d.ts +1 -1
- package/lib/makes/FS.js +328 -301
- package/lib/makes/LineConvertStream.js +37 -40
- package/lib/makes/Logger.d.ts +5 -3
- package/lib/makes/Logger.js +18 -34
- 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/{models → makes}/Project.d.ts +23 -16
- 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 +18 -0
- package/lib/plugins/ElasticSearchPlugin.js +72 -0
- package/lib/plugins/LocaltunnelPlugin.d.ts +4 -4
- package/lib/plugins/LocaltunnelPlugin.js +256 -255
- package/lib/plugins/MaildevPlugin.d.ts +4 -2
- package/lib/plugins/MaildevPlugin.js +45 -41
- package/lib/plugins/MongodbPlugin.d.ts +6 -4
- package/lib/plugins/MongodbPlugin.js +303 -254
- package/lib/plugins/NgrokPlugin.d.ts +3 -4
- package/lib/plugins/NgrokPlugin.js +221 -230
- package/lib/plugins/PageKitePlugin.d.ts +3 -4
- package/lib/plugins/PageKitePlugin.js +150 -147
- package/lib/plugins/PostgresPlugin.d.ts +1 -1
- package/lib/plugins/PostgresPlugin.js +115 -88
- package/lib/plugins/ProxmoxPlugin.d.ts +1 -1
- package/lib/plugins/ProxmoxPlugin.js +50 -38
- package/lib/plugins/RedisPlugin.d.ts +10 -2
- package/lib/plugins/RedisPlugin.js +77 -39
- package/lib/plugins/index.d.ts +2 -6
- package/lib/plugins/index.js +25 -158
- package/lib/services/AppConfigService.d.ts +13 -3
- package/lib/services/AppConfigService.js +161 -71
- package/lib/services/AppEventsService.d.ts +5 -8
- package/lib/services/AppEventsService.js +26 -25
- package/lib/services/DockerService.d.ts +51 -0
- package/lib/services/DockerService.js +200 -0
- package/lib/services/LogService.d.ts +12 -0
- package/lib/services/LogService.js +38 -0
- package/lib/services/PluginService.d.ts +11 -0
- package/lib/services/PluginService.js +15 -0
- package/lib/services/PresetService.d.ts +14 -0
- package/lib/services/PresetService.js +64 -0
- package/lib/services/ProjectService.d.ts +12 -4
- package/lib/services/ProjectService.js +141 -78
- package/lib/services/index.d.ts +4 -0
- package/lib/services/index.js +21 -36
- 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 -22
- package/lib/utils/escapeRegExp.js +4 -7
- package/lib/utils/exec.d.ts +1 -1
- package/lib/utils/exec.js +38 -40
- package/lib/utils/fetch.js +45 -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.d.ts +0 -4
- package/lib/utils/index.js +32 -235
- 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 +21 -47
- package/presets/bun/Dockerfile +11 -0
- package/presets/bun/config.json +3 -0
- package/presets/node/Dockerfile +4 -2
- package/presets/node/config.json +9 -7
- package/presets/php-apache/Dockerfile +40 -38
- package/presets/php-apache/config.json +10 -15
- package/presets/php-fpm/Dockerfile +21 -0
- package/presets/php-fpm/config.json +25 -0
- package/lib/models/Preset.d.ts +0 -19
- package/lib/models/Preset.js +0 -60
- package/lib/models/Project.js +0 -151
- package/lib/models/index.d.ts +0 -2
- package/lib/models/index.js +0 -27
- package/lib/plugins/MariadbPlugin.d.ts +0 -25
- package/lib/plugins/MariadbPlugin.js +0 -297
- package/lib/plugins/PresetPlugin.d.ts +0 -19
- package/lib/plugins/PresetPlugin.js +0 -164
- package/lib/plugins/ProjectPlugin.d.ts +0 -12
- package/lib/plugins/ProjectPlugin.js +0 -54
- package/lib/plugins/ProxyPlugin.js +0 -257
- package/lib/plugins/ServeoPlugin.d.ts +0 -36
- package/lib/plugins/ServeoPlugin.js +0 -260
- package/lib/plugins/TestPlugin.d.ts +0 -10
- package/lib/plugins/TestPlugin.js +0 -75
- package/lib/utils/promptConfirm.d.ts +0 -6
- package/lib/utils/promptConfirm.js +0 -21
- package/lib/utils/promptGroup.d.ts +0 -16
- package/lib/utils/promptGroup.js +0 -39
- package/lib/utils/promptSelect.d.ts +0 -12
- package/lib/utils/promptSelect.js +0 -47
- package/lib/utils/promptText.d.ts +0 -13
- package/lib/utils/promptText.js +0 -53
- package/plugins/mariadb/admin/conf/config.user.inc.php +0 -9
- package/plugins/serveo/Dockerfile +0 -17
package/lib/makes/index.js
CHANGED
|
@@ -1,71 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.keys(_Controller).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _Controller[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _Controller[key];
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
7
|
}
|
|
15
|
-
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _FS[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _Logger = require("./Logger");
|
|
40
|
-
Object.keys(_Logger).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _Logger[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _Logger[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
var _Plugin = require("./Plugin");
|
|
51
|
-
Object.keys(_Plugin).forEach(function (key) {
|
|
52
|
-
if (key === "default" || key === "__esModule") return;
|
|
53
|
-
if (key in exports && exports[key] === _Plugin[key]) return;
|
|
54
|
-
Object.defineProperty(exports, key, {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _Plugin[key];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
var _Repository = require("./Repository");
|
|
62
|
-
Object.keys(_Repository).forEach(function (key) {
|
|
63
|
-
if (key === "default" || key === "__esModule") return;
|
|
64
|
-
if (key in exports && exports[key] === _Repository[key]) return;
|
|
65
|
-
Object.defineProperty(exports, key, {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
get: function () {
|
|
68
|
-
return _Repository[key];
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
});
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Controller"), exports);
|
|
18
|
+
__exportStar(require("./DI"), exports);
|
|
19
|
+
__exportStar(require("./Docker"), exports);
|
|
20
|
+
__exportStar(require("./FS"), exports);
|
|
21
|
+
__exportStar(require("./Logger"), exports);
|
|
22
|
+
__exportStar(require("./Plugin"), exports);
|
|
23
|
+
__exportStar(require("./Preset"), exports);
|
|
24
|
+
__exportStar(require("./Project"), exports);
|
|
25
|
+
__exportStar(require("./Repository"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FSManager } from "@wocker/core";
|
|
2
|
+
import { Cli } from "@kearisp/cli";
|
|
3
|
+
import { Plugin, DI } from "../makes";
|
|
4
|
+
import { AppConfigService, DockerService } from "../services";
|
|
5
|
+
type StartOptions = {
|
|
6
|
+
restart?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare class ElasticSearchPlugin extends Plugin {
|
|
9
|
+
protected containerName: string;
|
|
10
|
+
protected appConfigService: AppConfigService;
|
|
11
|
+
protected dockerService: DockerService;
|
|
12
|
+
protected fs: FSManager;
|
|
13
|
+
constructor(di: DI);
|
|
14
|
+
install(cli: Cli): void;
|
|
15
|
+
start(options: StartOptions): Promise<void>;
|
|
16
|
+
stop(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export { ElasticSearchPlugin };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ElasticSearchPlugin = void 0;
|
|
4
|
+
const core_1 = require("@wocker/core");
|
|
5
|
+
const makes_1 = require("../makes");
|
|
6
|
+
const services_1 = require("../services");
|
|
7
|
+
class ElasticSearchPlugin extends makes_1.Plugin {
|
|
8
|
+
constructor(di) {
|
|
9
|
+
super("elastic-search");
|
|
10
|
+
this.containerName = "elastic-search.workspace";
|
|
11
|
+
this.appConfigService = di.resolveService(services_1.AppConfigService);
|
|
12
|
+
this.dockerService = di.resolveService(services_1.DockerService);
|
|
13
|
+
this.fs = new core_1.FSManager(this.appConfigService.pluginsPath("elastic-search"), this.appConfigService.dataPath("plugins/elastic-search"));
|
|
14
|
+
}
|
|
15
|
+
install(cli) {
|
|
16
|
+
super.install(cli);
|
|
17
|
+
cli.command("elastica:start")
|
|
18
|
+
.option("restart", {
|
|
19
|
+
type: "boolean",
|
|
20
|
+
alias: "r",
|
|
21
|
+
description: "Restart service"
|
|
22
|
+
})
|
|
23
|
+
.action((options) => this.start(options));
|
|
24
|
+
cli.command("elastica:stop")
|
|
25
|
+
.action(() => this.stop());
|
|
26
|
+
}
|
|
27
|
+
async start(options) {
|
|
28
|
+
const { restart } = options;
|
|
29
|
+
await this.dockerService.pullImage("docker.elastic.co/elasticsearch/elasticsearch:7.5.2");
|
|
30
|
+
let container = await this.dockerService.getContainer(this.containerName);
|
|
31
|
+
if (restart && container) {
|
|
32
|
+
await this.dockerService.removeContainer(this.containerName);
|
|
33
|
+
container = null;
|
|
34
|
+
}
|
|
35
|
+
if (!container) {
|
|
36
|
+
await this.fs.mkdir("data", {
|
|
37
|
+
recursive: true
|
|
38
|
+
});
|
|
39
|
+
container = await this.dockerService.createContainer({
|
|
40
|
+
name: this.containerName,
|
|
41
|
+
image: "docker.elastic.co/elasticsearch/elasticsearch:7.5.2",
|
|
42
|
+
ulimits: {
|
|
43
|
+
memlock: {
|
|
44
|
+
hard: -1,
|
|
45
|
+
soft: -1
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
env: {
|
|
49
|
+
"node.name": "elasticsearch",
|
|
50
|
+
"cluster.name": "elasticsearch",
|
|
51
|
+
"cluster.initial_master_nodes": "elasticsearch",
|
|
52
|
+
"bootstrap.memory_lock": "false",
|
|
53
|
+
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
|
|
54
|
+
},
|
|
55
|
+
volumes: [
|
|
56
|
+
`${this.fs.path("data")}:/usr/share/elasticsearch/data`
|
|
57
|
+
],
|
|
58
|
+
ports: [
|
|
59
|
+
"9200:9200"
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const { State: { Status } } = await container.inspect();
|
|
64
|
+
if (Status === "created" || Status === "exited") {
|
|
65
|
+
await container.start();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async stop() {
|
|
69
|
+
await this.dockerService.removeContainer(this.containerName);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.ElasticSearchPlugin = ElasticSearchPlugin;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Cli } from "@kearisp/cli";
|
|
2
|
-
import { Plugin } from "
|
|
3
|
-
import {
|
|
4
|
-
import { AppConfigService, AppEventsService, ProjectService } from "src/services";
|
|
2
|
+
import { DI, Plugin, Project } from "../makes";
|
|
3
|
+
import { AppConfigService, AppEventsService, ProjectService, DockerService } from "../services";
|
|
5
4
|
type InitOptions = {
|
|
6
5
|
name?: string;
|
|
7
6
|
};
|
|
@@ -20,7 +19,8 @@ declare class LocaltunnelPlugin extends Plugin {
|
|
|
20
19
|
protected appConfigService: AppConfigService;
|
|
21
20
|
protected appEventsService: AppEventsService;
|
|
22
21
|
protected projectService: ProjectService;
|
|
23
|
-
|
|
22
|
+
protected dockerService: DockerService;
|
|
23
|
+
constructor(di: DI);
|
|
24
24
|
install(cli: Cli): void;
|
|
25
25
|
getIp(): Promise<string>;
|
|
26
26
|
onProjectStart(project: Project): Promise<void>;
|