@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.
Files changed (107) hide show
  1. package/README.md +1 -1
  2. package/lib/App.d.ts +4 -3
  3. package/lib/App.js +98 -77
  4. package/lib/controllers/ImageController.d.ts +2 -2
  5. package/lib/controllers/ImageController.js +27 -27
  6. package/lib/controllers/PluginController.d.ts +2 -2
  7. package/lib/controllers/PluginController.js +78 -56
  8. package/lib/controllers/PresetController.d.ts +3 -1
  9. package/lib/controllers/PresetController.js +155 -136
  10. package/lib/controllers/ProjectController.d.ts +5 -5
  11. package/lib/controllers/ProjectController.js +653 -603
  12. package/lib/controllers/ProxyController.d.ts +4 -1
  13. package/lib/controllers/ProxyController.js +269 -245
  14. package/lib/controllers/index.js +19 -58
  15. package/lib/decorators/Inject.d.ts +1 -0
  16. package/lib/decorators/Inject.js +8 -0
  17. package/lib/decorators/Injectable.d.ts +4 -0
  18. package/lib/decorators/Injectable.js +17 -0
  19. package/lib/decorators/index.d.ts +1 -0
  20. package/lib/decorators/index.js +17 -0
  21. package/lib/env.js +33 -15
  22. package/lib/index.d.ts +3 -0
  23. package/lib/index.js +31 -16
  24. package/lib/makes/Controller.js +4 -8
  25. package/lib/makes/DI.d.ts +7 -0
  26. package/lib/makes/DI.js +27 -0
  27. package/lib/makes/Docker.js +298 -382
  28. package/lib/makes/FS.d.ts +3 -9
  29. package/lib/makes/FS.js +277 -305
  30. package/lib/makes/LineConvertStream.js +37 -40
  31. package/lib/makes/Logger.d.ts +9 -1
  32. package/lib/makes/Logger.js +22 -11
  33. package/lib/makes/Model.js +8 -12
  34. package/lib/makes/MySQL.js +6 -27
  35. package/lib/makes/Plugin.d.ts +1 -1
  36. package/lib/makes/Plugin.js +55 -37
  37. package/lib/makes/Preset.d.ts +46 -0
  38. package/lib/makes/Preset.js +33 -0
  39. package/lib/makes/Project.d.ts +45 -0
  40. package/lib/makes/Project.js +127 -0
  41. package/lib/makes/Repository.js +18 -21
  42. package/lib/makes/index.d.ts +3 -0
  43. package/lib/makes/index.js +23 -69
  44. package/lib/plugins/ElasticSearchPlugin.d.ts +3 -1
  45. package/lib/plugins/ElasticSearchPlugin.js +66 -66
  46. package/lib/plugins/LocaltunnelPlugin.d.ts +2 -2
  47. package/lib/plugins/LocaltunnelPlugin.js +256 -257
  48. package/lib/plugins/MaildevPlugin.d.ts +2 -2
  49. package/lib/plugins/MaildevPlugin.js +45 -44
  50. package/lib/plugins/MongodbPlugin.d.ts +2 -2
  51. package/lib/plugins/MongodbPlugin.js +303 -248
  52. package/lib/plugins/NgrokPlugin.d.ts +2 -2
  53. package/lib/plugins/NgrokPlugin.js +221 -231
  54. package/lib/plugins/PageKitePlugin.d.ts +2 -2
  55. package/lib/plugins/PageKitePlugin.js +150 -149
  56. package/lib/plugins/PostgresPlugin.d.ts +1 -1
  57. package/lib/plugins/PostgresPlugin.js +115 -89
  58. package/lib/plugins/ProxmoxPlugin.d.ts +1 -1
  59. package/lib/plugins/ProxmoxPlugin.js +50 -38
  60. package/lib/plugins/RedisPlugin.d.ts +3 -1
  61. package/lib/plugins/RedisPlugin.js +73 -72
  62. package/lib/plugins/index.js +25 -103
  63. package/lib/services/AppConfigService.d.ts +3 -3
  64. package/lib/services/AppConfigService.js +162 -157
  65. package/lib/services/AppEventsService.js +26 -24
  66. package/lib/services/DockerService.d.ts +37 -2
  67. package/lib/services/DockerService.js +185 -205
  68. package/lib/services/LogService.d.ts +3 -2
  69. package/lib/services/LogService.js +33 -34
  70. package/lib/services/PluginService.d.ts +2 -1
  71. package/lib/services/PluginService.js +11 -14
  72. package/lib/services/PresetService.d.ts +8 -3
  73. package/lib/services/PresetService.js +60 -59
  74. package/lib/services/ProjectService.d.ts +11 -4
  75. package/lib/services/ProjectService.js +140 -129
  76. package/lib/services/index.js +21 -80
  77. package/lib/types/Config.d.ts +4 -3
  78. package/lib/types/Config.js +1 -4
  79. package/lib/types/EnvConfig.js +1 -4
  80. package/lib/types/index.js +16 -25
  81. package/lib/utils/buildOptions.js +5 -8
  82. package/lib/utils/demuxOutput.js +16 -20
  83. package/lib/utils/escapeRegExp.js +4 -7
  84. package/lib/utils/exec.js +38 -39
  85. package/lib/utils/fetch.js +46 -30
  86. package/lib/utils/followProgress.js +66 -77
  87. package/lib/utils/format-size-units.js +16 -16
  88. package/lib/utils/get-config.d.ts +1 -1
  89. package/lib/utils/get-config.js +13 -16
  90. package/lib/utils/get-cursor-position.js +22 -29
  91. package/lib/utils/image-build.js +35 -23
  92. package/lib/utils/index.js +32 -191
  93. package/lib/utils/injectVariables.js +10 -13
  94. package/lib/utils/parse-table.js +20 -23
  95. package/lib/utils/set-config.d.ts +1 -1
  96. package/lib/utils/set-config.js +12 -15
  97. package/lib/utils/spawn.js +17 -20
  98. package/lib/utils/tty.js +2 -6
  99. package/lib/utils/volumeFormat.js +5 -12
  100. package/lib/utils/volumeParse.js +10 -13
  101. package/package.json +13 -39
  102. package/presets/bun/Dockerfile +11 -0
  103. package/presets/bun/config.json +3 -0
  104. package/presets/node/Dockerfile +4 -2
  105. package/presets/php-apache/Dockerfile +3 -2
  106. package/.github/workflows/publish.yml +0 -31
  107. package/plugins/mariadb/admin/conf/config.user.inc.php +0 -9
@@ -1,71 +1,25 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _Controller = require("./Controller");
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
- var _Docker = require("./Docker");
18
- Object.keys(_Docker).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _Docker[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _Docker[key];
25
- }
26
- });
27
- });
28
- var _FS = require("./FS");
29
- Object.keys(_FS).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _FS[key]) return;
32
- Object.defineProperty(exports, key, {
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 { DI, AppConfigService, DockerService, Plugin, FSManager } from "@wocker/core";
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
- var _core = require("@wocker/core");
8
- class ElasticSearchPlugin extends _core.Plugin {
9
- containerName = "elastic-search.workspace";
10
- constructor(di) {
11
- super();
12
- this.appConfigService = di.resolveService(_core.AppConfigService);
13
- this.dockerService = di.resolveService(_core.DockerService);
14
- this.fs = new _core.FSManager(this.appConfigService.pluginsPath("elastic-search"), this.appConfigService.dataPath("plugins/elastic-search"));
15
- }
16
- install(cli) {
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
- 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: [`${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
- const {
60
- State: {
61
- Status
62
- }
63
- } = await container.inspect();
64
- if (Status === "created" || Status === "exited") {
65
- await container.start();
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 "src/makes";
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
  };