@wocker/ws 1.0.21 → 1.0.23
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 +8 -0
- package/lib/AppModule.js +46 -75
- package/lib/controllers/DebugController.d.ts +4 -2
- package/lib/controllers/DebugController.js +19 -11
- package/lib/controllers/ExperimentalController.d.ts +8 -0
- package/lib/controllers/ExperimentalController.js +77 -0
- package/lib/controllers/PluginController.d.ts +4 -5
- package/lib/controllers/PluginController.js +14 -59
- package/lib/controllers/PresetController.d.ts +9 -3
- package/lib/controllers/PresetController.js +61 -52
- package/lib/controllers/ProjectController.d.ts +7 -2
- package/lib/controllers/ProjectController.js +124 -94
- package/lib/controllers/index.d.ts +1 -3
- package/lib/controllers/index.js +1 -3
- package/lib/env.d.ts +2 -2
- package/lib/env.js +3 -3
- package/lib/main.js +16 -7
- package/lib/makes/GithubClient.d.ts +14 -0
- package/lib/makes/GithubClient.js +65 -0
- package/lib/makes/Logger.d.ts +1 -1
- package/lib/makes/Plugin.d.ts +5 -0
- package/lib/makes/Plugin.js +15 -0
- package/lib/makes/index.d.ts +1 -1
- package/lib/makes/index.js +1 -1
- package/lib/modules/app/index.d.ts +2 -0
- package/lib/{plugins/proxmox → modules/app}/index.js +6 -13
- package/lib/modules/docker/index.d.ts +8 -0
- package/lib/modules/docker/index.js +41 -0
- package/lib/modules/docker/services/ContainerService.d.ts +14 -0
- package/lib/modules/docker/services/ContainerService.js +115 -0
- package/lib/{services → modules/docker/services}/DockerService.d.ts +12 -5
- package/lib/{services → modules/docker/services}/DockerService.js +33 -117
- package/lib/modules/docker/services/ImageService.d.ts +18 -0
- package/lib/modules/docker/services/ImageService.js +68 -0
- package/lib/modules/docker/services/ModemService.d.ts +14 -0
- package/lib/modules/docker/services/ModemService.js +137 -0
- package/lib/modules/docker/services/ProtoService.d.ts +6 -0
- package/lib/modules/docker/services/ProtoService.js +20 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/{plugins → modules}/index.js +3 -3
- package/lib/modules/keystore/controllers/KeystoreController.d.ts +11 -0
- package/lib/modules/keystore/controllers/KeystoreController.js +106 -0
- package/lib/modules/keystore/index.d.ts +4 -0
- package/lib/{plugins/elastic-search → modules/keystore}/index.js +16 -9
- package/lib/modules/keystore/providers/FileKeystoreProvider.d.ts +16 -0
- package/lib/modules/keystore/providers/FileKeystoreProvider.js +97 -0
- package/lib/modules/keystore/providers/KeytarKeystoreProvider.d.ts +9 -0
- package/lib/modules/keystore/providers/KeytarKeystoreProvider.js +74 -0
- package/lib/modules/keystore/services/KeystoreService.d.ts +12 -0
- package/lib/modules/keystore/services/KeystoreService.js +70 -0
- package/lib/modules/keystore/types/FileKeystore.d.ts +17 -0
- package/lib/modules/keystore/types/FileKeystore.js +33 -0
- package/lib/modules/keystore/types/Keytar.d.ts +8 -0
- package/lib/modules/keystore/types/Keytar.js +2 -0
- package/lib/modules/keystore/utils/createEncryptionKey.d.ts +1 -0
- package/lib/modules/keystore/utils/createEncryptionKey.js +46 -0
- package/lib/modules/keystore/utils/createPasswordHash.d.ts +1 -0
- package/lib/modules/keystore/utils/createPasswordHash.js +20 -0
- package/lib/modules/keystore/utils/decrypt.d.ts +1 -0
- package/lib/modules/keystore/utils/decrypt.js +15 -0
- package/lib/modules/keystore/utils/encrypt.d.ts +1 -0
- package/lib/modules/keystore/utils/encrypt.js +19 -0
- package/lib/modules/keystore/utils/index.d.ts +5 -0
- package/lib/{services → modules/keystore/utils}/index.js +5 -10
- package/lib/modules/keystore/utils/verifyPasswordHash.d.ts +1 -0
- package/lib/modules/keystore/utils/verifyPasswordHash.js +9 -0
- package/lib/{controllers → modules/proxy/controllers}/CertController.d.ts +2 -1
- package/lib/{controllers → modules/proxy/controllers}/CertController.js +4 -3
- package/lib/{controllers → modules/proxy/controllers}/ProxyController.d.ts +4 -1
- package/lib/{controllers → modules/proxy/controllers}/ProxyController.js +46 -37
- package/lib/modules/proxy/index.d.ts +5 -0
- package/lib/modules/proxy/index.js +39 -0
- package/lib/{services → modules/proxy/services}/CertService.d.ts +3 -3
- package/lib/{services → modules/proxy/services}/CertService.js +11 -11
- package/lib/{services → modules/proxy/services}/ProxyService.d.ts +2 -2
- package/lib/{services → modules/proxy/services}/ProxyService.js +21 -13
- package/lib/repositories/PresetRepository.d.ts +23 -0
- package/lib/repositories/PresetRepository.js +115 -0
- package/lib/repositories/index.d.ts +1 -0
- package/lib/repositories/index.js +17 -0
- package/lib/services/AppConfigService.d.ts +6 -2
- package/lib/services/AppConfigService.js +60 -53
- package/lib/services/AppEventsService.d.ts +4 -4
- package/lib/services/AppEventsService.js +14 -10
- package/lib/services/LogService.d.ts +3 -1
- package/lib/services/LogService.js +12 -10
- package/lib/services/PluginService.d.ts +8 -2
- package/lib/services/PluginService.js +69 -16
- package/lib/services/PresetService.d.ts +9 -8
- package/lib/services/PresetService.js +145 -260
- package/lib/services/ProjectService.d.ts +8 -5
- package/lib/services/ProjectService.js +44 -18
- package/lib/utils/followProgress2.d.ts +1 -0
- package/lib/utils/followProgress2.js +63 -0
- package/lib/utils/index.d.ts +1 -4
- package/lib/utils/index.js +1 -4
- package/package.json +24 -15
- package/proto/buildkit.proto +55 -0
- package/proto/solver/pb/ops.proto +443 -0
- package/lib/controllers/ImageController.d.ts +0 -7
- package/lib/controllers/ImageController.js +0 -46
- package/lib/makes/FS.d.ts +0 -27
- package/lib/makes/FS.js +0 -284
- package/lib/makes/LineConvertStream.d.ts +0 -11
- package/lib/makes/LineConvertStream.js +0 -42
- package/lib/makes/Model.d.ts +0 -5
- package/lib/makes/Model.js +0 -12
- package/lib/plugins/MongodbPlugin.d.ts +0 -20
- package/lib/plugins/MongodbPlugin.js +0 -288
- package/lib/plugins/elastic-search/controllers/ElasticSearchController.d.ts +0 -10
- package/lib/plugins/elastic-search/controllers/ElasticSearchController.js +0 -91
- package/lib/plugins/elastic-search/index.d.ts +0 -2
- package/lib/plugins/index.d.ts +0 -3
- package/lib/plugins/proxmox/controllers/ProxmoxController.d.ts +0 -14
- package/lib/plugins/proxmox/controllers/ProxmoxController.js +0 -127
- package/lib/plugins/proxmox/index.d.ts +0 -2
- package/lib/services/index.d.ts +0 -10
- package/lib/utils/followProgress.d.ts +0 -1
- package/lib/utils/followProgress.js +0 -73
- package/lib/utils/volumeFormat.d.ts +0 -6
- package/lib/utils/volumeFormat.js +0 -8
- package/lib/utils/volumeParse.d.ts +0 -2
- package/lib/utils/volumeParse.js +0 -13
- package/presets/bun/Dockerfile +0 -11
- package/presets/bun/config.json +0 -4
- /package/lib/{utils/format-size-units.d.ts → modules/docker/utils/formatSizeUnits.d.ts} +0 -0
- /package/lib/{utils/format-size-units.js → modules/docker/utils/formatSizeUnits.js} +0 -0
package/README.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
###### Docker workspace for web projects
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/@wocker/ws)
|
|
6
|
+
[](https://github.com/kearisp/wocker-ws/actions/workflows/publish-latest.yml)
|
|
7
|
+
[](https://github.com/kearisp/wocker-ws/blob/main/LICENSE)
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@wocker/ws)
|
|
10
|
+
[](https://bundlephobia.com/package/@wocker/ws)
|
|
11
|
+

|
|
12
|
+
|
|
5
13
|
## Installation
|
|
6
14
|
|
|
7
15
|
**Note:** It is recommended to install Wocker globally to ensure accessibility from any directory in your terminal.
|
package/lib/AppModule.js
CHANGED
|
@@ -1,76 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
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;
|
|
17
|
-
});
|
|
18
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
7
|
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
8
|
var AppModule_1;
|
|
42
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
10
|
exports.AppModule = void 0;
|
|
44
11
|
const core_1 = require("@wocker/core");
|
|
45
12
|
const controllers_1 = require("./controllers");
|
|
46
|
-
const
|
|
47
|
-
const
|
|
13
|
+
const repositories_1 = require("./repositories");
|
|
14
|
+
const AppConfigService_1 = require("./services/AppConfigService");
|
|
15
|
+
const AppEventsService_1 = require("./services/AppEventsService");
|
|
16
|
+
const PluginService_1 = require("./services/PluginService");
|
|
17
|
+
const PresetService_1 = require("./services/PresetService");
|
|
18
|
+
const ProjectService_1 = require("./services/ProjectService");
|
|
19
|
+
const NpmService_1 = require("./services/NpmService");
|
|
20
|
+
const LogService_1 = require("./services/LogService");
|
|
21
|
+
const modules_1 = require("./modules");
|
|
48
22
|
let AppModule = AppModule_1 = class AppModule {
|
|
49
23
|
async load(container) {
|
|
50
|
-
const appConfigService = container.getModule(AppModule_1).get(
|
|
51
|
-
const logService = container.getModule(AppModule_1).get(
|
|
52
|
-
const
|
|
24
|
+
const appConfigService = container.getModule(AppModule_1).get(AppConfigService_1.AppConfigService);
|
|
25
|
+
const logService = container.getModule(AppModule_1).get(LogService_1.LogService);
|
|
26
|
+
const pluginService = container.getModule(AppModule_1).get(PluginService_1.PluginService);
|
|
53
27
|
const imports = [];
|
|
54
|
-
for (const
|
|
28
|
+
for (const pluginData of appConfigService.config.plugins || []) {
|
|
55
29
|
try {
|
|
56
|
-
const
|
|
57
|
-
if (!Plugin) {
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
const name = Reflect.getMetadata(core_1.PLUGIN_NAME_METADATA, Plugin);
|
|
30
|
+
const plugin = await pluginService.import(pluginData.name);
|
|
61
31
|
Reflect.defineMetadata(core_1.MODULE_METADATA.PROVIDERS, [
|
|
62
|
-
...Reflect.getMetadata(core_1.MODULE_METADATA.PROVIDERS,
|
|
32
|
+
...Reflect.getMetadata(core_1.MODULE_METADATA.PROVIDERS, plugin.type) || [],
|
|
63
33
|
{
|
|
64
34
|
provide: core_1.PLUGIN_DIR_KEY,
|
|
65
|
-
useValue:
|
|
35
|
+
useValue: appConfigService.dataPath("plugins", plugin.name)
|
|
66
36
|
}
|
|
67
|
-
],
|
|
68
|
-
imports.push(
|
|
37
|
+
], plugin.type);
|
|
38
|
+
imports.push(plugin.type);
|
|
69
39
|
}
|
|
70
40
|
catch (err) {
|
|
71
41
|
logService.error(err.message);
|
|
72
|
-
config.removePlugin(
|
|
73
|
-
|
|
42
|
+
appConfigService.config.removePlugin(pluginData.name);
|
|
43
|
+
appConfigService.save();
|
|
74
44
|
throw err;
|
|
75
45
|
}
|
|
76
46
|
}
|
|
@@ -83,38 +53,39 @@ exports.AppModule = AppModule;
|
|
|
83
53
|
exports.AppModule = AppModule = AppModule_1 = __decorate([
|
|
84
54
|
(0, core_1.Global)(),
|
|
85
55
|
(0, core_1.Module)({
|
|
56
|
+
imports: [
|
|
57
|
+
modules_1.DockerModule,
|
|
58
|
+
modules_1.KeystoreModule,
|
|
59
|
+
modules_1.ProxyModule
|
|
60
|
+
],
|
|
86
61
|
controllers: [
|
|
87
62
|
controllers_1.CompletionController,
|
|
88
|
-
controllers_1.DebugController,
|
|
89
|
-
controllers_1.ImageController,
|
|
90
|
-
controllers_1.PluginController,
|
|
91
|
-
controllers_1.PresetController,
|
|
92
63
|
controllers_1.ProjectController,
|
|
93
|
-
controllers_1.
|
|
94
|
-
controllers_1.
|
|
64
|
+
controllers_1.PresetController,
|
|
65
|
+
controllers_1.PluginController,
|
|
66
|
+
controllers_1.ExperimentalController,
|
|
67
|
+
controllers_1.DebugController
|
|
95
68
|
],
|
|
96
69
|
providers: [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
services_1.ProxyService,
|
|
106
|
-
services_1.CertService
|
|
70
|
+
AppConfigService_1.AppConfigService,
|
|
71
|
+
AppEventsService_1.AppEventsService,
|
|
72
|
+
LogService_1.LogService,
|
|
73
|
+
NpmService_1.NpmService,
|
|
74
|
+
ProjectService_1.ProjectService,
|
|
75
|
+
PluginService_1.PluginService,
|
|
76
|
+
PresetService_1.PresetService,
|
|
77
|
+
repositories_1.PresetRepository
|
|
107
78
|
],
|
|
108
79
|
exports: [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
80
|
+
AppConfigService_1.AppConfigService,
|
|
81
|
+
AppEventsService_1.AppEventsService,
|
|
82
|
+
LogService_1.LogService,
|
|
83
|
+
modules_1.DockerService,
|
|
84
|
+
modules_1.CertService,
|
|
85
|
+
modules_1.ContainerService,
|
|
86
|
+
ProjectService_1.ProjectService,
|
|
87
|
+
modules_1.ProxyService,
|
|
88
|
+
modules_1.KeystoreService
|
|
118
89
|
]
|
|
119
90
|
})
|
|
120
91
|
], AppModule);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { AppConfigService
|
|
1
|
+
import { AppConfigService } from "../services/AppConfigService";
|
|
2
|
+
import { LogService } from "../services/LogService";
|
|
2
3
|
export declare class DebugController {
|
|
3
4
|
protected readonly appConfigService: AppConfigService;
|
|
4
5
|
protected readonly logService: LogService;
|
|
5
6
|
constructor(appConfigService: AppConfigService, logService: LogService);
|
|
6
|
-
debug(
|
|
7
|
+
debug(): Promise<string>;
|
|
8
|
+
setDebug(status: string): Promise<void>;
|
|
7
9
|
setLog(level: string): Promise<void>;
|
|
8
10
|
testLog(level: string, args: string[]): Promise<void>;
|
|
9
11
|
debugCompletion(): Promise<string[]>;
|
|
@@ -14,25 +14,27 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.DebugController = void 0;
|
|
16
16
|
const core_1 = require("@wocker/core");
|
|
17
|
-
const
|
|
17
|
+
const AppConfigService_1 = require("../services/AppConfigService");
|
|
18
|
+
const LogService_1 = require("../services/LogService");
|
|
18
19
|
let DebugController = class DebugController {
|
|
19
20
|
constructor(appConfigService, logService) {
|
|
20
21
|
this.appConfigService = appConfigService;
|
|
21
22
|
this.logService = logService;
|
|
22
23
|
}
|
|
23
|
-
async debug(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
async debug() {
|
|
25
|
+
return this.appConfigService.config.debug ? "on" : "off";
|
|
26
|
+
}
|
|
27
|
+
async setDebug(status) {
|
|
28
|
+
this.appConfigService.config.debug = status === "on";
|
|
29
|
+
this.appConfigService.save();
|
|
27
30
|
}
|
|
28
31
|
async setLog(level) {
|
|
29
32
|
const validLevels = this.getLevels();
|
|
30
33
|
if (!validLevels.includes(level)) {
|
|
31
34
|
throw new Error(`Invalid log level: ${level}. Valid options are ${validLevels.join(', ')}`);
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
await config.save();
|
|
36
|
+
this.appConfigService.config.logLevel = level;
|
|
37
|
+
this.appConfigService.save();
|
|
36
38
|
}
|
|
37
39
|
async testLog(level, args) {
|
|
38
40
|
this.logService._log(level, ...args);
|
|
@@ -45,6 +47,12 @@ let DebugController = class DebugController {
|
|
|
45
47
|
}
|
|
46
48
|
};
|
|
47
49
|
exports.DebugController = DebugController;
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, core_1.Command)("debug"),
|
|
52
|
+
__metadata("design:type", Function),
|
|
53
|
+
__metadata("design:paramtypes", []),
|
|
54
|
+
__metadata("design:returntype", Promise)
|
|
55
|
+
], DebugController.prototype, "debug", null);
|
|
48
56
|
__decorate([
|
|
49
57
|
(0, core_1.Command)("debug:<status>"),
|
|
50
58
|
(0, core_1.Command)("debug <status>"),
|
|
@@ -52,7 +60,7 @@ __decorate([
|
|
|
52
60
|
__metadata("design:type", Function),
|
|
53
61
|
__metadata("design:paramtypes", [String]),
|
|
54
62
|
__metadata("design:returntype", Promise)
|
|
55
|
-
], DebugController.prototype, "
|
|
63
|
+
], DebugController.prototype, "setDebug", null);
|
|
56
64
|
__decorate([
|
|
57
65
|
(0, core_1.Description)("Set the log level (options: debug, log, info, warn, error)"),
|
|
58
66
|
(0, core_1.Command)("loglevel <level>"),
|
|
@@ -83,6 +91,6 @@ __decorate([
|
|
|
83
91
|
], DebugController.prototype, "getLevels", null);
|
|
84
92
|
exports.DebugController = DebugController = __decorate([
|
|
85
93
|
(0, core_1.Controller)(),
|
|
86
|
-
__metadata("design:paramtypes", [
|
|
87
|
-
|
|
94
|
+
__metadata("design:paramtypes", [AppConfigService_1.AppConfigService,
|
|
95
|
+
LogService_1.LogService])
|
|
88
96
|
], DebugController);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AppConfigService } from "../services/AppConfigService";
|
|
2
|
+
export declare class ExperimentalController {
|
|
3
|
+
protected readonly appService: AppConfigService;
|
|
4
|
+
constructor(appService: AppConfigService);
|
|
5
|
+
enable(feature?: string): void;
|
|
6
|
+
disable(feature?: string): void;
|
|
7
|
+
getFeatures(): string[];
|
|
8
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ExperimentalController = void 0;
|
|
16
|
+
const core_1 = require("@wocker/core");
|
|
17
|
+
const AppConfigService_1 = require("../services/AppConfigService");
|
|
18
|
+
let ExperimentalController = class ExperimentalController {
|
|
19
|
+
constructor(appService) {
|
|
20
|
+
this.appService = appService;
|
|
21
|
+
}
|
|
22
|
+
enable(feature) {
|
|
23
|
+
if (!feature) {
|
|
24
|
+
throw new core_1.UsageException("Feature name is required. Usage: wocker experimental:enable <feature-name>\n");
|
|
25
|
+
}
|
|
26
|
+
if (!this.appService.experimentalFeatures.includes(feature)) {
|
|
27
|
+
const availableFeatures = this.appService.experimentalFeatures.join(", ");
|
|
28
|
+
throw new core_1.UsageException(`Unknown experimental feature: "${feature}"\nAvailable features: ${availableFeatures}`);
|
|
29
|
+
}
|
|
30
|
+
this.appService.setMeta(`experimental.${feature}`, "enabled");
|
|
31
|
+
this.appService.save();
|
|
32
|
+
}
|
|
33
|
+
disable(feature) {
|
|
34
|
+
if (!feature) {
|
|
35
|
+
throw new core_1.UsageException("Feature name is required. Usage: wocker experimental:disable <feature-name>\n");
|
|
36
|
+
}
|
|
37
|
+
if (!this.appService.experimentalFeatures.includes(feature)) {
|
|
38
|
+
const availableFeatures = this.appService.experimentalFeatures.join(", ");
|
|
39
|
+
throw new core_1.UsageException(`Unknown experimental feature: "${feature}"\nAvailable features: ${availableFeatures}`);
|
|
40
|
+
}
|
|
41
|
+
this.appService.unsetMeta(`experimental.${feature}`);
|
|
42
|
+
this.appService.save();
|
|
43
|
+
}
|
|
44
|
+
getFeatures() {
|
|
45
|
+
return this.appService.experimentalFeatures;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.ExperimentalController = ExperimentalController;
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, core_1.Command)("experimental:enable [feature]"),
|
|
51
|
+
(0, core_1.Description)("Enable experimental features"),
|
|
52
|
+
__param(0, (0, core_1.Param)("feature")),
|
|
53
|
+
__param(0, (0, core_1.Description)("Name of the feature to enable")),
|
|
54
|
+
__metadata("design:type", Function),
|
|
55
|
+
__metadata("design:paramtypes", [String]),
|
|
56
|
+
__metadata("design:returntype", void 0)
|
|
57
|
+
], ExperimentalController.prototype, "enable", null);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, core_1.Command)("experimental:disable [feature]"),
|
|
60
|
+
(0, core_1.Description)("Disable experimental features"),
|
|
61
|
+
__param(0, (0, core_1.Param)("feature")),
|
|
62
|
+
__param(0, (0, core_1.Description)("Name of the feature to disable")),
|
|
63
|
+
__metadata("design:type", Function),
|
|
64
|
+
__metadata("design:paramtypes", [String]),
|
|
65
|
+
__metadata("design:returntype", void 0)
|
|
66
|
+
], ExperimentalController.prototype, "disable", null);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, core_1.Completion)("feature"),
|
|
69
|
+
__metadata("design:type", Function),
|
|
70
|
+
__metadata("design:paramtypes", []),
|
|
71
|
+
__metadata("design:returntype", Array)
|
|
72
|
+
], ExperimentalController.prototype, "getFeatures", null);
|
|
73
|
+
exports.ExperimentalController = ExperimentalController = __decorate([
|
|
74
|
+
(0, core_1.Controller)(),
|
|
75
|
+
(0, core_1.Description)("Manage experimental features"),
|
|
76
|
+
__metadata("design:paramtypes", [AppConfigService_1.AppConfigService])
|
|
77
|
+
], ExperimentalController);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { AppConfigService
|
|
1
|
+
import { AppConfigService } from "../services/AppConfigService";
|
|
2
|
+
import { PluginService } from "../services/PluginService";
|
|
2
3
|
export declare class PluginController {
|
|
3
4
|
protected readonly appConfigService: AppConfigService;
|
|
4
5
|
protected readonly pluginService: PluginService;
|
|
5
|
-
|
|
6
|
-
protected readonly logService: LogService;
|
|
7
|
-
constructor(appConfigService: AppConfigService, pluginService: PluginService, npmService: NpmService, logService: LogService);
|
|
6
|
+
constructor(appConfigService: AppConfigService, pluginService: PluginService);
|
|
8
7
|
list(): Promise<string>;
|
|
9
|
-
add(addName: string,
|
|
8
|
+
add(addName: string, beta?: boolean): Promise<void>;
|
|
10
9
|
remove(removeName: string): Promise<void>;
|
|
11
10
|
update(): Promise<void>;
|
|
12
11
|
getInstalledPlugins(): string[];
|
|
@@ -11,74 +11,30 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
-
};
|
|
17
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
15
|
exports.PluginController = void 0;
|
|
19
16
|
const core_1 = require("@wocker/core");
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const services_1 = require("../services");
|
|
17
|
+
const AppConfigService_1 = require("../services/AppConfigService");
|
|
18
|
+
const PluginService_1 = require("../services/PluginService");
|
|
23
19
|
let PluginController = class PluginController {
|
|
24
|
-
constructor(appConfigService, pluginService
|
|
20
|
+
constructor(appConfigService, pluginService) {
|
|
25
21
|
this.appConfigService = appConfigService;
|
|
26
22
|
this.pluginService = pluginService;
|
|
27
|
-
this.npmService = npmService;
|
|
28
|
-
this.logService = logService;
|
|
29
23
|
}
|
|
30
24
|
async list() {
|
|
31
|
-
|
|
32
|
-
const table = new cli_table3_1.default({
|
|
33
|
-
head: ["Name"],
|
|
34
|
-
colWidths: [30]
|
|
35
|
-
});
|
|
36
|
-
if (!config.plugins) {
|
|
37
|
-
return chalk_1.default.gray("No plugins installed");
|
|
38
|
-
}
|
|
39
|
-
for (const name of config.plugins) {
|
|
40
|
-
table.push([name]);
|
|
41
|
-
}
|
|
42
|
-
return table.toString() + "\n";
|
|
25
|
+
return this.pluginService.getPluginsTable();
|
|
43
26
|
}
|
|
44
|
-
async add(addName,
|
|
45
|
-
|
|
46
|
-
const fullName = `${prefix}${name}${suffix}`;
|
|
47
|
-
const config = this.appConfigService.getConfig();
|
|
48
|
-
try {
|
|
49
|
-
if (await this.pluginService.checkPlugin(fullName)) {
|
|
50
|
-
config.addPlugin(fullName);
|
|
51
|
-
await config.save();
|
|
52
|
-
console.info(`Plugin ${fullName} activated`);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const packageInfo = await this.npmService.getPackageInfo(fullName);
|
|
56
|
-
await this.npmService.install(fullName, packageInfo["dist-tags"].dev && dev ? "dev" : "latest");
|
|
57
|
-
if (await this.pluginService.checkPlugin(fullName)) {
|
|
58
|
-
config.addPlugin(fullName);
|
|
59
|
-
await config.save();
|
|
60
|
-
console.info(`Plugin ${fullName} activated`);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
catch (err) {
|
|
65
|
-
this.logService.error(err.message);
|
|
66
|
-
}
|
|
27
|
+
async add(addName, beta) {
|
|
28
|
+
await this.pluginService.install(addName, beta);
|
|
67
29
|
}
|
|
68
30
|
async remove(removeName) {
|
|
69
|
-
|
|
70
|
-
const fullName = `${prefix}${name}${suffix}`;
|
|
71
|
-
const config = this.appConfigService.getConfig();
|
|
72
|
-
config.removePlugin(fullName);
|
|
73
|
-
await config.save();
|
|
74
|
-
console.info(`Plugin ${fullName} deactivated`);
|
|
31
|
+
await this.pluginService.uninstall(removeName);
|
|
75
32
|
}
|
|
76
33
|
async update() {
|
|
77
34
|
await this.pluginService.update();
|
|
78
35
|
}
|
|
79
36
|
getInstalledPlugins() {
|
|
80
|
-
|
|
81
|
-
return config.plugins || [];
|
|
37
|
+
return this.appConfigService.config.plugins.map(p => p.name);
|
|
82
38
|
}
|
|
83
39
|
};
|
|
84
40
|
exports.PluginController = PluginController;
|
|
@@ -92,12 +48,12 @@ __decorate([
|
|
|
92
48
|
__decorate([
|
|
93
49
|
(0, core_1.Command)("plugin:add <name>"),
|
|
94
50
|
(0, core_1.Command)("plugin:install <name>"),
|
|
95
|
-
(0, core_1.Description)("Install a plugin"),
|
|
51
|
+
(0, core_1.Description)("Install a plugin by specifying its name"),
|
|
96
52
|
__param(0, (0, core_1.Param)("name")),
|
|
97
|
-
__param(1, (0, core_1.Option)("
|
|
53
|
+
__param(1, (0, core_1.Option)("beta", {
|
|
98
54
|
type: "boolean",
|
|
99
55
|
alias: "d",
|
|
100
|
-
description: "Use
|
|
56
|
+
description: "Use the beta version of the plugin (if a beta version exists). Defaults to the latest stable version."
|
|
101
57
|
})),
|
|
102
58
|
__metadata("design:type", Function),
|
|
103
59
|
__metadata("design:paramtypes", [String, Boolean]),
|
|
@@ -125,8 +81,7 @@ __decorate([
|
|
|
125
81
|
], PluginController.prototype, "getInstalledPlugins", null);
|
|
126
82
|
exports.PluginController = PluginController = __decorate([
|
|
127
83
|
(0, core_1.Controller)(),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
services_1.LogService])
|
|
84
|
+
(0, core_1.Description)("Plugin commands"),
|
|
85
|
+
__metadata("design:paramtypes", [AppConfigService_1.AppConfigService,
|
|
86
|
+
PluginService_1.PluginService])
|
|
132
87
|
], PluginController);
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { Project } from "@wocker/core";
|
|
2
|
-
import {
|
|
2
|
+
import { PresetRepository } from "../repositories";
|
|
3
|
+
import { AppConfigService } from "../services/AppConfigService";
|
|
4
|
+
import { AppEventsService } from "../services/AppEventsService";
|
|
5
|
+
import { ProjectService } from "../services/ProjectService";
|
|
6
|
+
import { PresetService } from "../services/PresetService";
|
|
7
|
+
import { DockerService } from "../modules";
|
|
3
8
|
export declare class PresetController {
|
|
4
9
|
protected readonly appConfigService: AppConfigService;
|
|
5
10
|
protected readonly appEventsService: AppEventsService;
|
|
6
11
|
protected readonly projectService: ProjectService;
|
|
7
12
|
protected readonly presetService: PresetService;
|
|
13
|
+
protected readonly presetRepository: PresetRepository;
|
|
8
14
|
protected readonly dockerService: DockerService;
|
|
9
|
-
constructor(appConfigService: AppConfigService, appEventsService: AppEventsService, projectService: ProjectService, presetService: PresetService, dockerService: DockerService);
|
|
15
|
+
constructor(appConfigService: AppConfigService, appEventsService: AppEventsService, projectService: ProjectService, presetService: PresetService, presetRepository: PresetRepository, dockerService: DockerService);
|
|
10
16
|
presets(): Promise<string[]>;
|
|
11
17
|
protected onInit(project: Project): Promise<void>;
|
|
12
18
|
protected onRebuild(project: Project): Promise<void>;
|
|
13
19
|
protected onBeforeStart(project: Project): Promise<void>;
|
|
14
20
|
init(): Promise<void>;
|
|
15
|
-
|
|
21
|
+
destroy(): Promise<void>;
|
|
16
22
|
add(name: string, version?: string): Promise<void>;
|
|
17
23
|
list(): Promise<string>;
|
|
18
24
|
delete(name: string, confirm?: boolean): Promise<void>;
|