@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
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);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FSManager } from "@wocker/core";
|
|
2
2
|
import { Cli } from "@kearisp/cli";
|
|
3
|
+
import { Plugin, DI } from "../makes";
|
|
4
|
+
import { AppConfigService, DockerService } from "../services";
|
|
3
5
|
type StartOptions = {
|
|
4
6
|
restart?: boolean;
|
|
5
7
|
};
|
|
@@ -1,72 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ElasticSearchPlugin = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
super.install(cli);
|
|
18
|
-
cli.command("elastica:start").option("restart", {
|
|
19
|
-
type: "boolean",
|
|
20
|
-
alias: "r",
|
|
21
|
-
description: "Restart service"
|
|
22
|
-
}).action(options => this.start(options));
|
|
23
|
-
cli.command("elastica:stop").action(() => this.stop());
|
|
24
|
-
}
|
|
25
|
-
async start(options) {
|
|
26
|
-
const {
|
|
27
|
-
restart
|
|
28
|
-
} = 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;
|
|
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"));
|
|
34
14
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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: [`${this.fs.path("data")}:/usr/share/elasticsearch/data`],
|
|
56
|
-
ports: ["9200:9200"]
|
|
57
|
-
});
|
|
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());
|
|
58
26
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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);
|
|
66
70
|
}
|
|
67
|
-
}
|
|
68
|
-
async stop() {
|
|
69
|
-
await this.dockerService.removeContainer(this.containerName);
|
|
70
|
-
}
|
|
71
71
|
}
|
|
72
|
-
exports.ElasticSearchPlugin = ElasticSearchPlugin;
|
|
72
|
+
exports.ElasticSearchPlugin = ElasticSearchPlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Project, DI, AppConfigService, AppEventsService, ProjectService, DockerService } 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, DockerService } from "../services";
|
|
4
4
|
type InitOptions = {
|
|
5
5
|
name?: string;
|
|
6
6
|
};
|