@wocker/ws 1.0.2 → 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 +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/env.js +33 -15
- package/lib/index.d.ts +2 -0
- package/lib/index.js +30 -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.js +328 -304
- 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/README.md
CHANGED
|
@@ -26,4 +26,4 @@ This will enable tab completion for `ws` commands, providing a more convenient a
|
|
|
26
26
|
|
|
27
27
|
Wocker is a powerful tool for managing your web project's Docker workspace. It provides a convenient and efficient way to set up and manage your Docker containers.
|
|
28
28
|
|
|
29
|
-
For more information and detailed usage, please refer to the [documentation](https://kearisp.github.io/wocker)
|
|
29
|
+
For more information and detailed usage, please refer to the [documentation](https://kearisp.github.io/wocker).
|
package/lib/App.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Controller } from "@wocker/core";
|
|
2
2
|
import { Cli } from "@kearisp/cli";
|
|
3
|
-
import {
|
|
3
|
+
import { DI } from "./makes";
|
|
4
|
+
import { AppConfigService } from "./services";
|
|
4
5
|
export declare class App {
|
|
5
6
|
protected di: DI;
|
|
6
7
|
protected cli: Cli;
|
|
@@ -10,6 +11,6 @@ export declare class App {
|
|
|
10
11
|
use(Constructor: {
|
|
11
12
|
new (...params: any[]): Controller;
|
|
12
13
|
}): void;
|
|
13
|
-
setDebug(status: string): Promise<
|
|
14
|
+
setDebug(status: string): Promise<string>;
|
|
14
15
|
run(): Promise<string>;
|
|
15
16
|
}
|
package/lib/App.js
CHANGED
|
@@ -1,86 +1,107 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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]; } };
|
|
7
|
+
}
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
5
17
|
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.App = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _controllers = require("./controllers");
|
|
15
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
27
|
+
const cli_1 = require("@kearisp/cli");
|
|
28
|
+
const Path = __importStar(require("path"));
|
|
29
|
+
const env_1 = require("./env");
|
|
30
|
+
const utils_1 = require("./utils");
|
|
31
|
+
const makes_1 = require("./makes");
|
|
32
|
+
const services_1 = require("./services");
|
|
33
|
+
const controllers_1 = require("./controllers");
|
|
17
34
|
class App {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
_core.Logger.info(`Set debug ${status}`);
|
|
53
|
-
await (0, _utils.setConfig)({
|
|
54
|
-
debug: status === "on"
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
async run() {
|
|
58
|
-
const mapDir = Path.dirname(_env.MAP_PATH);
|
|
59
|
-
if (!_makes.FS.existsSync(mapDir)) {
|
|
60
|
-
await _makes.FS.mkdir(mapDir);
|
|
35
|
+
constructor() {
|
|
36
|
+
this.di = new makes_1.DI();
|
|
37
|
+
this.appConfigService = new services_1.AppConfigService();
|
|
38
|
+
this.di.registerService(services_1.AppConfigService, this.appConfigService);
|
|
39
|
+
this.di.registerService(services_1.AppEventsService, new services_1.AppEventsService());
|
|
40
|
+
this.di.registerService(services_1.DockerService, new services_1.DockerService(this.di));
|
|
41
|
+
this.di.registerService(services_1.PresetService, new services_1.PresetService(this.di));
|
|
42
|
+
this.di.registerService(services_1.PluginService, new services_1.PluginService(this.di));
|
|
43
|
+
this.di.registerService(services_1.ProjectService, new services_1.ProjectService(this.di));
|
|
44
|
+
this.di.registerService(services_1.LogService, new services_1.LogService(this.di));
|
|
45
|
+
this.di.registerService(cli_1.Cli, this.cli);
|
|
46
|
+
this.cli = new cli_1.Cli(makes_1.Logger);
|
|
47
|
+
makes_1.Preset.install(this.di);
|
|
48
|
+
makes_1.Project.install(this.di);
|
|
49
|
+
makes_1.Logger.install(this.di);
|
|
50
|
+
this.install();
|
|
51
|
+
this.use(controllers_1.ImageController);
|
|
52
|
+
this.use(controllers_1.PluginController);
|
|
53
|
+
this.use(controllers_1.PresetController);
|
|
54
|
+
this.use(controllers_1.ProjectController);
|
|
55
|
+
this.use(controllers_1.ProxyController);
|
|
56
|
+
}
|
|
57
|
+
install() {
|
|
58
|
+
this.cli.command("completion script")
|
|
59
|
+
.help(false)
|
|
60
|
+
.action(() => this.cli.completionScript());
|
|
61
|
+
this.cli.command("log [...items]")
|
|
62
|
+
.action((options, items) => {
|
|
63
|
+
makes_1.Logger.log(...items);
|
|
64
|
+
return "";
|
|
65
|
+
});
|
|
66
|
+
this.cli.command("debug <status>")
|
|
67
|
+
.completion("status", () => ["on", "off"])
|
|
68
|
+
.action(async (options, status) => this.setDebug(status));
|
|
61
69
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
70
|
+
use(Constructor) {
|
|
71
|
+
const controller = new Constructor(this.di);
|
|
72
|
+
controller.install(this.cli);
|
|
66
73
|
}
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
async setDebug(status) {
|
|
75
|
+
makes_1.Logger.info(`Set debug ${status}`);
|
|
76
|
+
await (0, utils_1.setConfig)({
|
|
77
|
+
debug: status === "on"
|
|
78
|
+
});
|
|
79
|
+
return "";
|
|
69
80
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
async run() {
|
|
82
|
+
const mapDir = Path.dirname(env_1.MAP_PATH);
|
|
83
|
+
if (!makes_1.FS.existsSync(mapDir)) {
|
|
84
|
+
await makes_1.FS.mkdir(mapDir);
|
|
85
|
+
}
|
|
86
|
+
if (!makes_1.FS.existsSync(env_1.MAP_PATH)) {
|
|
87
|
+
await makes_1.FS.writeJSON(env_1.MAP_PATH, {
|
|
88
|
+
projects: []
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (!makes_1.FS.existsSync(`${env_1.DATA_DIR}/projects`)) {
|
|
92
|
+
await makes_1.FS.mkdir(`${env_1.DATA_DIR}/projects`);
|
|
93
|
+
}
|
|
94
|
+
const { plugins = [] } = await this.appConfigService.getAppConfig();
|
|
95
|
+
for (const plugin of plugins) {
|
|
96
|
+
try {
|
|
97
|
+
const { default: Plugin } = await Promise.resolve(`${plugin}`).then(s => __importStar(require(s)));
|
|
98
|
+
this.use(Plugin);
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
makes_1.Logger.error(err.message);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return this.cli.run(process.argv);
|
|
82
105
|
}
|
|
83
|
-
return this.cli.run(process.argv);
|
|
84
|
-
}
|
|
85
106
|
}
|
|
86
|
-
exports.App = App;
|
|
107
|
+
exports.App = App;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AppConfigService, DI } from "@wocker/core";
|
|
2
1
|
import { Cli } from "@kearisp/cli";
|
|
3
|
-
import { Controller } from "
|
|
2
|
+
import { DI, Controller } from "../makes";
|
|
3
|
+
import { AppConfigService } from "../services";
|
|
4
4
|
declare class ImageController extends Controller {
|
|
5
5
|
protected appConfigService: AppConfigService;
|
|
6
6
|
constructor(di: DI);
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ImageController = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
7
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
8
|
+
const makes_1 = require("../makes");
|
|
9
|
+
const services_1 = require("../services");
|
|
10
|
+
class ImageController extends makes_1.Controller {
|
|
11
|
+
constructor(di) {
|
|
12
|
+
super();
|
|
13
|
+
this.appConfigService = di.resolveService(services_1.AppConfigService);
|
|
14
|
+
}
|
|
15
|
+
install(cli) {
|
|
16
|
+
super.install(cli);
|
|
17
|
+
cli.command("images")
|
|
18
|
+
.action(() => this.list());
|
|
19
|
+
}
|
|
20
|
+
async list() {
|
|
21
|
+
const images = await makes_1.Docker.imageLs({});
|
|
22
|
+
const table = new cli_table3_1.default({
|
|
23
|
+
head: ["Name"]
|
|
24
|
+
});
|
|
25
|
+
for (const image of images) {
|
|
26
|
+
table.push([image.Id]);
|
|
27
|
+
}
|
|
28
|
+
return table.toString() + "\n";
|
|
27
29
|
}
|
|
28
|
-
return table.toString() + "\n";
|
|
29
|
-
}
|
|
30
30
|
}
|
|
31
|
-
exports.ImageController = ImageController;
|
|
31
|
+
exports.ImageController = ImageController;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DI, AppConfigService, Controller } from "@wocker/core";
|
|
2
1
|
import { Cli } from "@kearisp/cli";
|
|
3
|
-
import {
|
|
2
|
+
import { DI, Controller } from "../makes";
|
|
3
|
+
import { AppConfigService, PluginService } from "../services";
|
|
4
4
|
type AddOptions = {};
|
|
5
5
|
type RemoveOptions = {};
|
|
6
6
|
declare class PluginController extends Controller {
|
|
@@ -1,62 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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]; } };
|
|
7
|
+
}
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
5
17
|
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.PluginController = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
const axios_1 = __importDefault(require("axios"));
|
|
31
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
32
|
+
const makes_1 = require("../makes");
|
|
33
|
+
const services_1 = require("../services");
|
|
34
|
+
const utils_1 = require("../utils");
|
|
35
|
+
class PluginController extends makes_1.Controller {
|
|
36
|
+
constructor(di) {
|
|
37
|
+
super();
|
|
38
|
+
this.appConfigService = di.resolveService(services_1.AppConfigService);
|
|
39
|
+
this.pluginService = di.resolveService(services_1.PluginService);
|
|
40
|
+
}
|
|
41
|
+
install(cli) {
|
|
42
|
+
super.install(cli);
|
|
43
|
+
cli.command("plugin:add <name>")
|
|
44
|
+
.action((options, name) => this.add(options, name));
|
|
45
|
+
cli.command("plugin:remove <name>")
|
|
46
|
+
.action((options, name) => this.remove(options, name));
|
|
47
|
+
}
|
|
48
|
+
async add(options, addName) {
|
|
49
|
+
const [, prefix = "@wocker/", name, suffix = "-plugin"] = /^(@wocker\/)?(\w+)(-plugin)?$/.exec(addName) || [];
|
|
50
|
+
const fullName = `${prefix}${name}${suffix}`;
|
|
51
|
+
try {
|
|
52
|
+
const { default: Plugin } = await Promise.resolve(`${fullName}`).then(s => __importStar(require(s)));
|
|
53
|
+
this.pluginService.use(Plugin);
|
|
54
|
+
await this.appConfigService.activatePlugin(fullName);
|
|
55
|
+
console.info(`Plugin ${fullName} activated`);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
makes_1.Logger.error(err.message);
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const res = await axios_1.default.get(`https://registry.npmjs.org/${encodeURIComponent(fullName)}`, {
|
|
63
|
+
validateStatus: () => true
|
|
64
|
+
});
|
|
65
|
+
if (res.status !== 200) {
|
|
66
|
+
console.error(chalk_1.default.red(`Plugin ${fullName} not found`));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
console.info(`Installing ${fullName}`);
|
|
70
|
+
await (0, utils_1.exec)(`npm install -g ${fullName}`);
|
|
71
|
+
await this.appConfigService.activatePlugin(fullName);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
makes_1.Logger.error(err.message);
|
|
75
|
+
}
|
|
39
76
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
console.error(_chalk.default.red(`Plugin ${fullName} not found`));
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
console.info(`Installing ${fullName}`);
|
|
49
|
-
await (0, _utils.exec)(`npm install -g ${fullName}`);
|
|
50
|
-
await this.appConfigService.activatePlugin(fullName);
|
|
51
|
-
} catch (err) {
|
|
52
|
-
_core.Logger.error(err.message);
|
|
77
|
+
async remove(options, removeName) {
|
|
78
|
+
const [, prefix = "@wocker/", name, suffix = "-plugin"] = /^(@wocker\/)?(\w+)(-plugin)?$/.exec(removeName) || [];
|
|
79
|
+
const fullName = `${prefix}${name}${suffix}`;
|
|
80
|
+
await this.appConfigService.deactivatePlugin(fullName);
|
|
81
|
+
console.info(`Plugin ${fullName} deactivated`);
|
|
53
82
|
}
|
|
54
|
-
}
|
|
55
|
-
async remove(options, removeName) {
|
|
56
|
-
const [, prefix = "@wocker/", name, suffix = "-plugin"] = /^(@wocker\/)?(\w+)(-plugin)?$/.exec(removeName) || [];
|
|
57
|
-
const fullName = `${prefix}${name}${suffix}`;
|
|
58
|
-
await this.appConfigService.deactivatePlugin(fullName);
|
|
59
|
-
console.info(`Plugin ${fullName} deactivated`);
|
|
60
|
-
}
|
|
61
83
|
}
|
|
62
|
-
exports.PluginController = PluginController;
|
|
84
|
+
exports.PluginController = PluginController;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Cli } from "@wocker/core";
|
|
2
|
+
import { DI, Controller, Project } from "../makes";
|
|
3
|
+
import { AppConfigService, AppEventsService, ProjectService, PresetService, DockerService } from "../services";
|
|
2
4
|
type BuildParams = {
|
|
3
5
|
rebuild?: boolean;
|
|
4
6
|
};
|