@wocker/core 1.0.25 → 1.0.26-beta.0
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/core/ApplicationContext.d.ts +1 -1
- package/lib/core/AsyncStorage.d.ts +10 -2
- package/lib/core/AsyncStorage.js +9 -1
- package/lib/core/Container.d.ts +3 -2
- package/lib/core/Container.js +8 -0
- package/lib/core/InstanceWrapper.d.ts +1 -2
- package/lib/core/InstanceWrapper.js +4 -4
- package/lib/core/ModuleWrapper.d.ts +10 -6
- package/lib/core/ModuleWrapper.js +21 -2
- package/lib/core/Route.d.ts +1 -3
- package/lib/core/Route.js +6 -8
- package/lib/core/Scanner.d.ts +10 -7
- package/lib/core/Scanner.js +71 -39
- package/lib/decorators/Description.js +13 -0
- package/lib/decorators/Module.d.ts +1 -8
- package/lib/decorators/Option.js +19 -6
- package/lib/decorators/Optional.d.ts +1 -0
- package/lib/decorators/Optional.js +22 -0
- package/lib/decorators/Param.js +15 -2
- package/lib/decorators/Plugin.d.ts +2 -7
- package/lib/decorators/Plugin.js +3 -1
- package/lib/decorators/index.d.ts +1 -5
- package/lib/decorators/index.js +1 -0
- package/lib/env.d.ts +2 -1
- package/lib/env.js +3 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/makes/AppConfig.d.ts +1 -6
- package/lib/makes/AppConfig.js +1 -10
- package/lib/makes/index.d.ts +0 -1
- package/lib/makes/index.js +0 -1
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +17 -0
- package/lib/modules/project/index.d.ts +4 -0
- package/lib/modules/project/index.js +25 -0
- package/lib/{makes → modules/project/makes}/Project.d.ts +27 -25
- package/lib/modules/project/makes/Project.js +281 -0
- package/lib/modules/project/repositories/ProjectRepository.d.ts +11 -0
- package/lib/modules/project/repositories/ProjectRepository.js +16 -0
- package/lib/{services → modules/project/services}/ProjectService.d.ts +3 -7
- package/lib/{services → modules/project/services}/ProjectService.js +1 -1
- package/lib/modules/project/types/ProjectType.d.ts +5 -0
- package/lib/modules/project/types/ProjectType.js +7 -0
- package/lib/modules/project/types/ProjectV1.d.ts +23 -0
- package/lib/modules/project/types/ProjectV1.js +2 -0
- package/lib/modules/project/types/ServiceProperties.d.ts +9 -0
- package/lib/modules/project/types/ServiceProperties.js +2 -0
- package/lib/modules/project/types/index.d.ts +3 -0
- package/lib/modules/project/types/index.js +19 -0
- package/lib/services/AppConfigService.d.ts +4 -2
- package/lib/services/AppConfigService.js +18 -11
- package/lib/services/AppService.d.ts +1 -1
- package/lib/services/AppService.js +2 -2
- package/lib/services/index.d.ts +0 -1
- package/lib/services/index.js +0 -1
- package/lib/types/ArgMeta.d.ts +1 -0
- package/lib/types/DynamicModule.d.ts +9 -0
- package/lib/types/DynamicModule.js +2 -0
- package/lib/types/ModuleMetadata.d.ts +11 -0
- package/lib/types/ModuleMetadata.js +3 -0
- package/lib/types/PluginMetadata.d.ts +5 -0
- package/lib/types/PluginMetadata.js +3 -0
- package/lib/types/index.d.ts +14 -0
- package/lib/types/index.js +4 -0
- package/package.json +7 -9
- package/lib/makes/Project.js +0 -200
|
@@ -0,0 +1,19 @@
|
|
|
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 __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("./ProjectType"), exports);
|
|
18
|
+
__exportStar(require("./ProjectV1"), exports);
|
|
19
|
+
__exportStar(require("./ServiceProperties"), exports);
|
|
@@ -41,12 +41,14 @@ export declare class AppConfigService {
|
|
|
41
41
|
* @deprecated
|
|
42
42
|
*/
|
|
43
43
|
getConfig(): AppConfig;
|
|
44
|
-
addProject(
|
|
45
|
-
removeProject(
|
|
44
|
+
addProject(name: string, path: string): void;
|
|
45
|
+
removeProject(name: string): void;
|
|
46
46
|
registerPreset(name: string, source: PresetSource, path?: string): void;
|
|
47
47
|
unregisterPreset(name: string): void;
|
|
48
48
|
addPlugin(name: string, env?: PluginRef["env"]): void;
|
|
49
49
|
removePlugin(name: string): void;
|
|
50
|
+
setEnv(name: string, value: string): void;
|
|
51
|
+
unsetEnv(name: string): void;
|
|
50
52
|
getMeta(name: string, byDefault?: string): string | undefined;
|
|
51
53
|
getMeta(name: string, byDefault: string): string;
|
|
52
54
|
setMeta(name: string, value: string): void;
|
|
@@ -19,7 +19,7 @@ exports.AppConfigService = void 0;
|
|
|
19
19
|
const path_1 = __importDefault(require("path"));
|
|
20
20
|
const decorators_1 = require("../decorators");
|
|
21
21
|
const AppConfig_1 = require("../makes/AppConfig");
|
|
22
|
-
const
|
|
22
|
+
const modules_1 = require("../modules");
|
|
23
23
|
const AppFileSystemService_1 = require("./AppFileSystemService");
|
|
24
24
|
const ProcessService_1 = require("./ProcessService");
|
|
25
25
|
const env_1 = require("../env");
|
|
@@ -29,16 +29,17 @@ let AppConfigService = class AppConfigService {
|
|
|
29
29
|
this.processService = processService;
|
|
30
30
|
this.fs = fs;
|
|
31
31
|
this.mapTypes = {
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
32
|
+
[modules_1.PROJECT_TYPE_PRESET]: "Preset",
|
|
33
|
+
[modules_1.PROJECT_TYPE_IMAGE]: "Image",
|
|
34
|
+
[modules_1.PROJECT_TYPE_DOCKERFILE]: "Dockerfile"
|
|
35
35
|
};
|
|
36
36
|
this._pwd = (process.cwd() || process.env.PWD);
|
|
37
37
|
}
|
|
38
38
|
get experimentalFeatures() {
|
|
39
39
|
return [
|
|
40
40
|
"projectComposeType",
|
|
41
|
-
"buildKit"
|
|
41
|
+
"buildKit",
|
|
42
|
+
"dns"
|
|
42
43
|
];
|
|
43
44
|
}
|
|
44
45
|
get debug() {
|
|
@@ -135,11 +136,11 @@ let AppConfigService = class AppConfigService {
|
|
|
135
136
|
getConfig() {
|
|
136
137
|
return this.config;
|
|
137
138
|
}
|
|
138
|
-
addProject(
|
|
139
|
-
this.config.addProject(
|
|
139
|
+
addProject(name, path) {
|
|
140
|
+
this.config.addProject(name, path);
|
|
140
141
|
}
|
|
141
|
-
removeProject(
|
|
142
|
-
this.config.removeProject(
|
|
142
|
+
removeProject(name) {
|
|
143
|
+
this.config.removeProject(name);
|
|
143
144
|
this.save();
|
|
144
145
|
}
|
|
145
146
|
registerPreset(name, source, path) {
|
|
@@ -156,6 +157,12 @@ let AppConfigService = class AppConfigService {
|
|
|
156
157
|
removePlugin(name) {
|
|
157
158
|
this.config.removePlugin(name);
|
|
158
159
|
}
|
|
160
|
+
setEnv(name, value) {
|
|
161
|
+
this.config.setEnv(name, value);
|
|
162
|
+
}
|
|
163
|
+
unsetEnv(name) {
|
|
164
|
+
this.config.unsetEnv(name);
|
|
165
|
+
}
|
|
159
166
|
getMeta(name, byDefault) {
|
|
160
167
|
return this.config.getMeta(name, byDefault);
|
|
161
168
|
}
|
|
@@ -170,7 +177,7 @@ let AppConfigService = class AppConfigService {
|
|
|
170
177
|
}
|
|
171
178
|
getProjectTypes() {
|
|
172
179
|
if (this.isExperimentalEnabled("projectComposeType")) {
|
|
173
|
-
return Object.assign(Object.assign({}, this.mapTypes), { [
|
|
180
|
+
return Object.assign(Object.assign({}, this.mapTypes), { [modules_1.PROJECT_TYPE_COMPOSE]: "Docker compose" });
|
|
174
181
|
}
|
|
175
182
|
return this.mapTypes;
|
|
176
183
|
}
|
|
@@ -182,7 +189,7 @@ let AppConfigService = class AppConfigService {
|
|
|
182
189
|
});
|
|
183
190
|
}
|
|
184
191
|
fs.writeFile("wocker.config.js", this.config.toJsString());
|
|
185
|
-
fs.
|
|
192
|
+
fs.writeJSON("wocker.config.json", this.config.toObject()); // Backup file
|
|
186
193
|
if (fs.exists("data.json")) {
|
|
187
194
|
fs.rm("data.json");
|
|
188
195
|
}
|
|
@@ -13,7 +13,7 @@ export declare class AppService {
|
|
|
13
13
|
isVersionGTE(version: string): boolean;
|
|
14
14
|
get experimentalFeatures(): string[];
|
|
15
15
|
getProjectTypes(): TypeMap;
|
|
16
|
-
addProject(
|
|
16
|
+
addProject(name: string, path: string): void;
|
|
17
17
|
getMeta(name: string, byDefault?: string): string | undefined;
|
|
18
18
|
getMeta(name: string, byDefault: string): string;
|
|
19
19
|
}
|
|
@@ -45,8 +45,8 @@ let AppService = class AppService {
|
|
|
45
45
|
getProjectTypes() {
|
|
46
46
|
return this.appConfigService.getProjectTypes();
|
|
47
47
|
}
|
|
48
|
-
addProject(
|
|
49
|
-
this.appConfigService.addProject(
|
|
48
|
+
addProject(name, path) {
|
|
49
|
+
this.appConfigService.addProject(name, path);
|
|
50
50
|
this.appConfigService.save();
|
|
51
51
|
}
|
|
52
52
|
getMeta(name, byDefault) {
|
package/lib/services/index.d.ts
CHANGED
package/lib/services/index.js
CHANGED
|
@@ -26,5 +26,4 @@ __exportStar(require("./PluginConfigService"), exports);
|
|
|
26
26
|
__exportStar(require("./PluginFileSystemService"), exports);
|
|
27
27
|
__exportStar(require("./PresetService"), exports);
|
|
28
28
|
__exportStar(require("./ProcessService"), exports);
|
|
29
|
-
__exportStar(require("./ProjectService"), exports);
|
|
30
29
|
__exportStar(require("./ProxyService"), exports);
|
package/lib/types/ArgMeta.d.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InjectionToken } from "./InjectionToken";
|
|
2
|
+
import { Type } from "./Type";
|
|
3
|
+
import { ModuleMetadata } from "./ModuleMetadata";
|
|
4
|
+
export type DynamicModule = ModuleMetadata & {
|
|
5
|
+
module: Type;
|
|
6
|
+
global?: boolean;
|
|
7
|
+
inject?: Array<InjectionToken | Type>;
|
|
8
|
+
useFactory?: (...args: any[]) => ModuleMetadata | Promise<ModuleMetadata>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MODULE_METADATA } from "../env";
|
|
2
|
+
import { ProviderType } from "./ProviderType";
|
|
3
|
+
import { Type } from "./Type";
|
|
4
|
+
import { DynamicModule } from "./DynamicModule";
|
|
5
|
+
import { InjectionToken } from "./InjectionToken";
|
|
6
|
+
export type ModuleMetadata = {
|
|
7
|
+
[MODULE_METADATA.IMPORTS]?: Array<Type | DynamicModule>;
|
|
8
|
+
[MODULE_METADATA.CONTROLLERS]?: Type[];
|
|
9
|
+
[MODULE_METADATA.PROVIDERS]?: ProviderType[];
|
|
10
|
+
[MODULE_METADATA.EXPORTS]?: Array<InjectionToken | Type>;
|
|
11
|
+
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
export * from "./DynamicModule";
|
|
1
2
|
export * from "./EnvConfig";
|
|
2
3
|
export * from "./FileSystemDriver";
|
|
3
4
|
export * from "./InjectionToken";
|
|
5
|
+
export * from "./ModuleMetadata";
|
|
4
6
|
export * from "./PickProperties";
|
|
7
|
+
export * from "./PluginMetadata";
|
|
8
|
+
export * from "./Type";
|
|
5
9
|
export * from "./Volume";
|
|
6
10
|
export * from "./ProviderType";
|
|
11
|
+
export type {
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated
|
|
14
|
+
*/
|
|
15
|
+
ModuleMetadata as ModuleConfig } from "./ModuleMetadata";
|
|
16
|
+
export type {
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
*/
|
|
20
|
+
PluginMetadata as PluginConfig } from "./PluginMetadata";
|
package/lib/types/index.js
CHANGED
|
@@ -14,9 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DynamicModule"), exports);
|
|
17
18
|
__exportStar(require("./EnvConfig"), exports);
|
|
18
19
|
__exportStar(require("./FileSystemDriver"), exports);
|
|
19
20
|
__exportStar(require("./InjectionToken"), exports);
|
|
21
|
+
__exportStar(require("./ModuleMetadata"), exports);
|
|
20
22
|
__exportStar(require("./PickProperties"), exports);
|
|
23
|
+
__exportStar(require("./PluginMetadata"), exports);
|
|
24
|
+
__exportStar(require("./Type"), exports);
|
|
21
25
|
__exportStar(require("./Volume"), exports);
|
|
22
26
|
__exportStar(require("./ProviderType"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wocker/core",
|
|
3
|
-
"
|
|
3
|
+
"type": "commonjs",
|
|
4
|
+
"version": "1.0.26-beta.0",
|
|
4
5
|
"author": "Kris Papercut <krispcut@gmail.com>",
|
|
5
6
|
"description": "Core of the Wocker",
|
|
6
7
|
"license": "MIT",
|
|
@@ -28,9 +29,6 @@
|
|
|
28
29
|
"dependencies": {
|
|
29
30
|
"@kearisp/cli": "^2.0.8",
|
|
30
31
|
"date-fns": "^4.1.0",
|
|
31
|
-
"fs": "^0.0.1-security",
|
|
32
|
-
"os": "^0.1.2",
|
|
33
|
-
"path": "^0.12.7",
|
|
34
32
|
"readline": "^1.3.0",
|
|
35
33
|
"reflect-metadata": "^0.2.2",
|
|
36
34
|
"stream": "^0.0.3",
|
|
@@ -39,14 +37,14 @@
|
|
|
39
37
|
"devDependencies": {
|
|
40
38
|
"@types/docker-modem": "^3.0.6",
|
|
41
39
|
"@types/dockerode": "^3.3.23",
|
|
42
|
-
"@types/jest": "^
|
|
43
|
-
"@types/node": "^24.
|
|
44
|
-
"jest": "^
|
|
40
|
+
"@types/jest": "^30.0.0",
|
|
41
|
+
"@types/node": "^24.5.2",
|
|
42
|
+
"jest": "^30.1.3",
|
|
45
43
|
"make-coverage-badge": "^1.2.0",
|
|
46
44
|
"memfs": "^4.17.1",
|
|
47
|
-
"ts-jest": "^29.
|
|
45
|
+
"ts-jest": "^29.4.4",
|
|
48
46
|
"ts-node": "^10.9.2",
|
|
49
|
-
"typescript": "^5.
|
|
47
|
+
"typescript": "^5.9.2",
|
|
50
48
|
"unionfs": "^4.5.4"
|
|
51
49
|
}
|
|
52
50
|
}
|
package/lib/makes/Project.js
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PROJECT_TYPE_COMPOSE = exports.PROJECT_TYPE_PRESET = exports.PROJECT_TYPE_IMAGE = exports.PROJECT_TYPE_DOCKERFILE = exports.Project = void 0;
|
|
4
|
-
const volumeParse_1 = require("../utils/volumeParse");
|
|
5
|
-
class Project {
|
|
6
|
-
constructor(data) {
|
|
7
|
-
Object.assign(this, data);
|
|
8
|
-
}
|
|
9
|
-
get containerName() {
|
|
10
|
-
return `${this.name}.workspace`;
|
|
11
|
-
}
|
|
12
|
-
get domains() {
|
|
13
|
-
const host = this.getEnv("VIRTUAL_HOST");
|
|
14
|
-
if (!host) {
|
|
15
|
-
return [];
|
|
16
|
-
}
|
|
17
|
-
return host.split(",");
|
|
18
|
-
}
|
|
19
|
-
hasDomain(domain) {
|
|
20
|
-
return this.domains.includes(domain);
|
|
21
|
-
}
|
|
22
|
-
addDomain(addDomain) {
|
|
23
|
-
let domains = [
|
|
24
|
-
...this.domains.filter((domain) => {
|
|
25
|
-
return domain !== addDomain;
|
|
26
|
-
}),
|
|
27
|
-
addDomain
|
|
28
|
-
];
|
|
29
|
-
this.setEnv("VIRTUAL_HOST", domains.join(","));
|
|
30
|
-
}
|
|
31
|
-
removeDomain(removeDomain) {
|
|
32
|
-
if (!this.hasDomain(removeDomain)) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
let domains = this.domains.filter((domain) => {
|
|
36
|
-
return domain !== removeDomain;
|
|
37
|
-
});
|
|
38
|
-
this.setEnv("VIRTUAL_HOST", domains.join(","));
|
|
39
|
-
}
|
|
40
|
-
clearDomains() {
|
|
41
|
-
this.unsetEnv("VIRTUAL_HOST");
|
|
42
|
-
}
|
|
43
|
-
linkPort(hostPort, containerPort) {
|
|
44
|
-
if (!this.ports) {
|
|
45
|
-
this.ports = [];
|
|
46
|
-
}
|
|
47
|
-
this.ports = [
|
|
48
|
-
...this.ports.filter((link) => {
|
|
49
|
-
return link !== `${hostPort}:${containerPort}`;
|
|
50
|
-
}),
|
|
51
|
-
`${hostPort}:${containerPort}`
|
|
52
|
-
];
|
|
53
|
-
}
|
|
54
|
-
unlinkPort(hostPort, containerPort) {
|
|
55
|
-
if (!this.ports) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
this.ports = this.ports.filter((link) => {
|
|
59
|
-
return link !== `${hostPort}:${containerPort}`;
|
|
60
|
-
});
|
|
61
|
-
if (this.ports.length === 0) {
|
|
62
|
-
delete this.ports;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
hasEnv(name) {
|
|
66
|
-
if (!this.env) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
return this.env.hasOwnProperty(name);
|
|
70
|
-
}
|
|
71
|
-
getEnv(name, defaultValue) {
|
|
72
|
-
const { [name]: value = defaultValue } = this.env || {};
|
|
73
|
-
return value;
|
|
74
|
-
}
|
|
75
|
-
setEnv(name, value) {
|
|
76
|
-
if (!this.env) {
|
|
77
|
-
this.env = {};
|
|
78
|
-
}
|
|
79
|
-
this.env[name] = typeof value === "boolean"
|
|
80
|
-
? (value ? "true" : "false")
|
|
81
|
-
: value;
|
|
82
|
-
}
|
|
83
|
-
unsetEnv(name) {
|
|
84
|
-
if (!this.env) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (name in this.env) {
|
|
88
|
-
delete this.env[name];
|
|
89
|
-
}
|
|
90
|
-
if (Object.keys(this.env).length === 0) {
|
|
91
|
-
delete this.env;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
hasMeta(name) {
|
|
95
|
-
return !!this.metadata && this.metadata.hasOwnProperty(name);
|
|
96
|
-
}
|
|
97
|
-
getMeta(name, defaultValue) {
|
|
98
|
-
const { [name]: value = defaultValue } = this.metadata || {};
|
|
99
|
-
return value;
|
|
100
|
-
}
|
|
101
|
-
setMeta(name, value) {
|
|
102
|
-
if (!this.metadata) {
|
|
103
|
-
this.metadata = {};
|
|
104
|
-
}
|
|
105
|
-
this.metadata[name] = typeof value === "boolean"
|
|
106
|
-
? (value ? "true" : "false")
|
|
107
|
-
: value;
|
|
108
|
-
}
|
|
109
|
-
unsetMeta(name) {
|
|
110
|
-
if (!this.metadata) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
if (name in this.metadata) {
|
|
114
|
-
delete this.metadata[name];
|
|
115
|
-
}
|
|
116
|
-
if (Object.keys(this.metadata).length === 0) {
|
|
117
|
-
delete this.metadata;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
getVolumeBySource(source) {
|
|
121
|
-
return (this.volumes || []).find((volume) => {
|
|
122
|
-
return (0, volumeParse_1.volumeParse)(volume).source === source;
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
getVolumeByDestination(destination) {
|
|
126
|
-
return (this.volumes || []).find((volume) => {
|
|
127
|
-
return (0, volumeParse_1.volumeParse)(volume).destination === destination;
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
volumeMount(...volumes) {
|
|
131
|
-
if (volumes.length === 0) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const [volume, ...restVolumes] = volumes;
|
|
135
|
-
const { destination } = (0, volumeParse_1.volumeParse)(volume);
|
|
136
|
-
this.volumes = [
|
|
137
|
-
...(this.volumes || []).filter((v) => {
|
|
138
|
-
return v !== this.getVolumeByDestination(destination);
|
|
139
|
-
}),
|
|
140
|
-
volume
|
|
141
|
-
];
|
|
142
|
-
this.volumeMount(...restVolumes);
|
|
143
|
-
}
|
|
144
|
-
volumeUnmount(...volumes) {
|
|
145
|
-
if (!this.volumes || volumes.length === 0) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
const [volume, ...restVolumes] = volumes;
|
|
149
|
-
const v = (0, volumeParse_1.volumeParse)(volume);
|
|
150
|
-
this.volumes = this.volumes.filter((mounted) => {
|
|
151
|
-
const m = (0, volumeParse_1.volumeParse)(mounted);
|
|
152
|
-
return v.source !== m.source && v.destination !== m.destination;
|
|
153
|
-
});
|
|
154
|
-
if (this.volumes.length === 0) {
|
|
155
|
-
delete this.volumes;
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
this.volumeUnmount(...restVolumes);
|
|
159
|
-
}
|
|
160
|
-
addExtraHost(host, domain) {
|
|
161
|
-
if (!this.extraHosts) {
|
|
162
|
-
this.extraHosts = {};
|
|
163
|
-
}
|
|
164
|
-
this.extraHosts[host] = domain;
|
|
165
|
-
}
|
|
166
|
-
removeExtraHost(host) {
|
|
167
|
-
if (!this.extraHosts || !this.extraHosts[host]) {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
delete this.extraHosts[host];
|
|
171
|
-
if (Object.keys(this.extraHosts).length === 0) {
|
|
172
|
-
delete this.extraHosts;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
toObject() {
|
|
176
|
-
return {
|
|
177
|
-
id: this.id,
|
|
178
|
-
name: this.name,
|
|
179
|
-
type: this.type,
|
|
180
|
-
path: this.path,
|
|
181
|
-
preset: this.preset,
|
|
182
|
-
presetMode: this.presetMode,
|
|
183
|
-
imageName: this.imageName,
|
|
184
|
-
dockerfile: this.dockerfile,
|
|
185
|
-
composefile: this.composefile,
|
|
186
|
-
scripts: this.scripts,
|
|
187
|
-
ports: this.ports,
|
|
188
|
-
volumes: this.volumes,
|
|
189
|
-
env: this.env,
|
|
190
|
-
buildArgs: this.buildArgs,
|
|
191
|
-
extraHosts: this.extraHosts,
|
|
192
|
-
metadata: this.metadata
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
exports.Project = Project;
|
|
197
|
-
exports.PROJECT_TYPE_DOCKERFILE = "dockerfile";
|
|
198
|
-
exports.PROJECT_TYPE_IMAGE = "image";
|
|
199
|
-
exports.PROJECT_TYPE_PRESET = "preset";
|
|
200
|
-
exports.PROJECT_TYPE_COMPOSE = "compose";
|