@wocker/core 1.0.22-beta.3 → 1.0.22
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/lib/core/ControllerWrapper.js +2 -1
- package/lib/core/Route.js +2 -2
- package/lib/decorators/Controller.d.ts +1 -6
- package/lib/decorators/Controller.js +1 -9
- package/lib/decorators/Description.js +4 -4
- package/lib/decorators/Module.d.ts +2 -2
- package/lib/decorators/Option.d.ts +1 -1
- package/lib/decorators/Option.js +2 -2
- package/lib/decorators/Param.d.ts +0 -1
- package/lib/decorators/Param.js +0 -1
- package/lib/decorators/Plugin.d.ts +2 -2
- package/lib/decorators/index.d.ts +5 -0
- package/lib/env.d.ts +1 -3
- package/lib/env.js +2 -4
- package/lib/makes/AppConfig.d.ts +19 -9
- package/lib/makes/AppConfig.js +21 -22
- package/lib/makes/FS.js +1 -0
- package/lib/makes/Preset.d.ts +11 -7
- package/lib/makes/Preset.js +6 -3
- package/lib/services/AppConfigService.d.ts +3 -1
- package/lib/services/AppConfigService.js +10 -0
- package/package.json +1 -1
- package/test/index.ts +0 -6
|
@@ -4,6 +4,7 @@ exports.ControllerWrapper = void 0;
|
|
|
4
4
|
require("reflect-metadata");
|
|
5
5
|
const InstanceWrapper_1 = require("./InstanceWrapper");
|
|
6
6
|
const Route_1 = require("./Route");
|
|
7
|
+
const env_1 = require("../env");
|
|
7
8
|
class ControllerWrapper extends InstanceWrapper_1.InstanceWrapper {
|
|
8
9
|
constructor(module, type) {
|
|
9
10
|
super(module, type);
|
|
@@ -12,7 +13,7 @@ class ControllerWrapper extends InstanceWrapper_1.InstanceWrapper {
|
|
|
12
13
|
if (!this.type) {
|
|
13
14
|
return;
|
|
14
15
|
}
|
|
15
|
-
this.description = Reflect.getMetadata(
|
|
16
|
+
this.description = Reflect.getMetadata(env_1.DESCRIPTION_METADATA, this.type) || "";
|
|
16
17
|
for (const method of Object.getOwnPropertyNames(this.type.prototype)) {
|
|
17
18
|
const route = new Route_1.Route(this.type, method);
|
|
18
19
|
if (route.isCommand) {
|
package/lib/core/Route.js
CHANGED
|
@@ -15,10 +15,10 @@ class Route {
|
|
|
15
15
|
if (!descriptor) {
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
-
this.description = Reflect.getMetadata(env_1.
|
|
18
|
+
this.description = Reflect.getMetadata(env_1.DESCRIPTION_METADATA, descriptor.value) || "";
|
|
19
19
|
this.commandNames = Reflect.getMetadata(env_1.COMMAND_METADATA, descriptor.value) || [];
|
|
20
20
|
this.completions = Reflect.getMetadata(env_1.COMPLETION_METADATA, descriptor.value) || [];
|
|
21
|
-
const argsMeta = Reflect.getMetadata(env_1.ARGS_METADATA, this.type, this.method) || [], argsAliases = Reflect.getMetadata(env_1.ALIAS_METADATA, this.type, this.method) || {}, argsDescription = Reflect.getMetadata(env_1.
|
|
21
|
+
const argsMeta = Reflect.getMetadata(env_1.ARGS_METADATA, this.type, this.method) || [], argsAliases = Reflect.getMetadata(env_1.ALIAS_METADATA, this.type, this.method) || {}, argsDescription = Reflect.getMetadata(env_1.DESCRIPTION_METADATA, this.type, method) || {}, designTypes = Reflect.getMetadata(env_1.PARAMTYPES_METADATA, this.type.prototype, this.method) || [];
|
|
22
22
|
this.argsMeta = argsMeta;
|
|
23
23
|
this.designTypes = designTypes;
|
|
24
24
|
for (let i = 0; i < argsMeta.length; i++) {
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Controller = void 0;
|
|
4
|
-
const Controller = (
|
|
5
|
-
const { command, description } = params || {};
|
|
4
|
+
const Controller = () => {
|
|
6
5
|
return (target) => {
|
|
7
6
|
Reflect.defineMetadata("IS_CONTROLLER", true, target);
|
|
8
|
-
if (description) {
|
|
9
|
-
Reflect.defineMetadata("CONTROLLER_DESCRIPTION", description, target);
|
|
10
|
-
}
|
|
11
|
-
if (!command) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
// TODO:
|
|
15
7
|
};
|
|
16
8
|
};
|
|
17
9
|
exports.Controller = Controller;
|
|
@@ -7,7 +7,7 @@ const Description = (description) => {
|
|
|
7
7
|
return (target, propertyKey, descriptorOrIndex) => {
|
|
8
8
|
// Class
|
|
9
9
|
if (typeof target === "function" && typeof propertyKey === "undefined" && typeof descriptorOrIndex === "undefined") {
|
|
10
|
-
Reflect.defineMetadata(env_1.
|
|
10
|
+
Reflect.defineMetadata(env_1.DESCRIPTION_METADATA, description, target);
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
if (typeof target !== "object" || !propertyKey) {
|
|
@@ -15,16 +15,16 @@ const Description = (description) => {
|
|
|
15
15
|
}
|
|
16
16
|
// Property
|
|
17
17
|
if (typeof descriptorOrIndex === "undefined") {
|
|
18
|
-
Reflect.defineMetadata(env_1.
|
|
18
|
+
Reflect.defineMetadata(env_1.DESCRIPTION_METADATA, description, target, propertyKey);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
// Method
|
|
22
22
|
if (typeof descriptorOrIndex !== "number") {
|
|
23
|
-
Reflect.defineMetadata(env_1.
|
|
23
|
+
Reflect.defineMetadata(env_1.DESCRIPTION_METADATA, description, descriptorOrIndex.value);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
// Parameter
|
|
27
|
-
Reflect.defineMetadata(env_1.
|
|
27
|
+
Reflect.defineMetadata(env_1.DESCRIPTION_METADATA, Object.assign(Object.assign({}, Reflect.getMetadata(env_1.DESCRIPTION_METADATA, target.constructor, propertyKey) || {}), { [descriptorOrIndex]: description }), target.constructor, propertyKey);
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
exports.Description = Description;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { MODULE_METADATA } from "../env";
|
|
2
2
|
import { Provider } from "../types/Provider";
|
|
3
|
-
export type
|
|
3
|
+
export type ModuleMetadata = {
|
|
4
4
|
[MODULE_METADATA.CONTROLLERS]?: any[];
|
|
5
5
|
[MODULE_METADATA.PROVIDERS]?: Provider[];
|
|
6
6
|
[MODULE_METADATA.IMPORTS]?: any[];
|
|
7
7
|
[MODULE_METADATA.EXPORTS]?: any[];
|
|
8
8
|
};
|
|
9
|
-
export declare const Module: (config:
|
|
9
|
+
export declare const Module: (config: ModuleMetadata) => ClassDecorator;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { Option as O } from "@kearisp/cli";
|
|
3
3
|
type AliasOrParams = string | Partial<Omit<O, "name">>;
|
|
4
|
-
export declare const Option: (name: string,
|
|
4
|
+
export declare const Option: (name: string, aliasOrParams?: AliasOrParams) => ParameterDecorator;
|
|
5
5
|
export {};
|
package/lib/decorators/Option.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Option = void 0;
|
|
4
4
|
require("reflect-metadata");
|
|
5
5
|
const env_1 = require("../env");
|
|
6
|
-
const Option = (name,
|
|
6
|
+
const Option = (name, aliasOrParams) => {
|
|
7
7
|
return (target, key, index) => {
|
|
8
8
|
if (!key) {
|
|
9
9
|
return;
|
|
@@ -12,7 +12,7 @@ const Option = (name, params) => {
|
|
|
12
12
|
{
|
|
13
13
|
type: "option",
|
|
14
14
|
name,
|
|
15
|
-
params: typeof
|
|
15
|
+
params: typeof aliasOrParams === "string" ? { alias: aliasOrParams } : aliasOrParams,
|
|
16
16
|
index
|
|
17
17
|
},
|
|
18
18
|
...Reflect.getMetadata(env_1.ARGS_METADATA, target.constructor, key) || []
|
package/lib/decorators/Param.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleMetadata } from "./Module";
|
|
2
2
|
import { PLUGIN_NAME_METADATA } from "../env";
|
|
3
|
-
type PluginConfig =
|
|
3
|
+
type PluginConfig = ModuleMetadata & {
|
|
4
4
|
[PLUGIN_NAME_METADATA]: string;
|
|
5
5
|
};
|
|
6
6
|
export declare const Plugin: (config: PluginConfig) => ClassDecorator;
|
package/lib/env.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
export declare const IS_GLOBAL_METADATA = "IS_GLOBAL";
|
|
2
2
|
export declare const IS_MODULE_METADATA = "isModule";
|
|
3
3
|
export declare const INJECTABLE_WATERMARK = "__injectable__";
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const DESCRIPTION_METADATA = "__DESCRIPTION__";
|
|
5
5
|
export declare const COMMAND_METADATA = "command";
|
|
6
|
-
export declare const COMMAND_DESCRIPTION_METADATA = "__COMMAND_DESCRIPTION__";
|
|
7
6
|
export declare const COMPLETION_METADATA = "completion";
|
|
8
7
|
export declare const ARGS_METADATA = "__ARGS__";
|
|
9
8
|
export declare const ALIAS_METADATA = "__ALIAS_METADATA__";
|
|
10
|
-
export declare const ARGS_DESCRIPTION_METADATA = "__ARGS_DESCRIPTION__";
|
|
11
9
|
export declare const OPTION_META = "__OPTION_META__";
|
|
12
10
|
export declare const PARAMTYPES_METADATA = "design:paramtypes";
|
|
13
11
|
export declare const SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
package/lib/env.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MODULE_METADATA = exports.PLUGIN_NAME_METADATA = exports.PLUGIN_DIR_KEY = exports.INJECT_TOKEN_METADATA = exports.SELF_DECLARED_DEPS_METADATA = exports.PARAMTYPES_METADATA = exports.OPTION_META = exports.
|
|
3
|
+
exports.MODULE_METADATA = exports.PLUGIN_NAME_METADATA = exports.PLUGIN_DIR_KEY = exports.INJECT_TOKEN_METADATA = exports.SELF_DECLARED_DEPS_METADATA = exports.PARAMTYPES_METADATA = exports.OPTION_META = exports.ALIAS_METADATA = exports.ARGS_METADATA = exports.COMPLETION_METADATA = exports.COMMAND_METADATA = exports.DESCRIPTION_METADATA = exports.INJECTABLE_WATERMARK = exports.IS_MODULE_METADATA = exports.IS_GLOBAL_METADATA = void 0;
|
|
4
4
|
exports.IS_GLOBAL_METADATA = "IS_GLOBAL";
|
|
5
5
|
exports.IS_MODULE_METADATA = "isModule";
|
|
6
6
|
exports.INJECTABLE_WATERMARK = "__injectable__";
|
|
7
|
-
exports.
|
|
7
|
+
exports.DESCRIPTION_METADATA = "__DESCRIPTION__";
|
|
8
8
|
exports.COMMAND_METADATA = "command";
|
|
9
|
-
exports.COMMAND_DESCRIPTION_METADATA = "__COMMAND_DESCRIPTION__";
|
|
10
9
|
exports.COMPLETION_METADATA = "completion";
|
|
11
10
|
exports.ARGS_METADATA = "__ARGS__";
|
|
12
11
|
exports.ALIAS_METADATA = "__ALIAS_METADATA__";
|
|
13
|
-
exports.ARGS_DESCRIPTION_METADATA = "__ARGS_DESCRIPTION__";
|
|
14
12
|
exports.OPTION_META = "__OPTION_META__";
|
|
15
13
|
exports.PARAMTYPES_METADATA = "design:paramtypes";
|
|
16
14
|
exports.SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
package/lib/makes/AppConfig.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EnvConfig
|
|
2
|
-
import {
|
|
1
|
+
import { EnvConfig } from "../types";
|
|
2
|
+
import { PresetSource } from "./Preset";
|
|
3
3
|
type ProjectData = {
|
|
4
4
|
id: string;
|
|
5
5
|
name?: string;
|
|
@@ -13,20 +13,26 @@ type PluginData = {
|
|
|
13
13
|
};
|
|
14
14
|
type PresetData = {
|
|
15
15
|
name: string;
|
|
16
|
-
source:
|
|
16
|
+
source: PresetSource;
|
|
17
17
|
path?: string;
|
|
18
18
|
};
|
|
19
|
-
export type AppConfigProperties =
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export type AppConfigProperties = {
|
|
20
|
+
debug?: boolean;
|
|
21
|
+
keystore?: string;
|
|
22
|
+
logLevel?: "off" | "info" | "warn" | "error";
|
|
23
|
+
plugins?: PluginData[];
|
|
24
|
+
presets?: PresetData[];
|
|
25
|
+
projects?: ProjectData[];
|
|
26
|
+
meta?: EnvConfig;
|
|
27
|
+
env?: EnvConfig;
|
|
22
28
|
};
|
|
23
29
|
export declare abstract class AppConfig {
|
|
24
30
|
debug?: boolean;
|
|
25
31
|
keystore?: string;
|
|
26
32
|
logLevel: "off" | "info" | "warn" | "error";
|
|
27
33
|
plugins: PluginData[];
|
|
28
|
-
presets
|
|
29
|
-
projects
|
|
34
|
+
presets: PresetData[];
|
|
35
|
+
projects: ProjectData[];
|
|
30
36
|
meta?: EnvConfig;
|
|
31
37
|
env?: EnvConfig;
|
|
32
38
|
protected constructor(data: AppConfigProperties);
|
|
@@ -35,7 +41,7 @@ export declare abstract class AppConfig {
|
|
|
35
41
|
getProject(id: string): ProjectData | undefined;
|
|
36
42
|
addProject(id: string, name: string, path: string): void;
|
|
37
43
|
removeProject(id: string): void;
|
|
38
|
-
registerPreset(name: string, source:
|
|
44
|
+
registerPreset(name: string, source: PresetSource, path?: string): void;
|
|
39
45
|
unregisterPreset(name: string): void;
|
|
40
46
|
hasMeta(name: string): boolean;
|
|
41
47
|
getMeta(name: string): string | undefined;
|
|
@@ -47,7 +53,11 @@ export declare abstract class AppConfig {
|
|
|
47
53
|
setEnv(name: string, value: string): void;
|
|
48
54
|
unsetEnv(name: string): void;
|
|
49
55
|
abstract save(): void;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated
|
|
58
|
+
*/
|
|
50
59
|
toJson(): AppConfigProperties;
|
|
60
|
+
toObject(): AppConfigProperties;
|
|
51
61
|
toJsString(): string;
|
|
52
62
|
toString(): string;
|
|
53
63
|
}
|
package/lib/makes/AppConfig.js
CHANGED
|
@@ -16,7 +16,7 @@ const Preset_1 = require("./Preset");
|
|
|
16
16
|
class AppConfig {
|
|
17
17
|
constructor(data) {
|
|
18
18
|
this.logLevel = "off";
|
|
19
|
-
const { plugins = [] } = data, rest = __rest(data, ["plugins"]);
|
|
19
|
+
const { plugins = [], presets = [], projects = [] } = data, rest = __rest(data, ["plugins", "presets", "projects"]);
|
|
20
20
|
Object.assign(this, rest);
|
|
21
21
|
this.plugins = plugins.map((plugin) => {
|
|
22
22
|
if (typeof plugin === "string") {
|
|
@@ -27,6 +27,8 @@ class AppConfig {
|
|
|
27
27
|
}
|
|
28
28
|
return plugin;
|
|
29
29
|
});
|
|
30
|
+
this.presets = presets;
|
|
31
|
+
this.projects = projects;
|
|
30
32
|
}
|
|
31
33
|
addPlugin(name, env = "latest") {
|
|
32
34
|
const plugin = this.plugins.find((plugin) => plugin.name === name);
|
|
@@ -77,21 +79,21 @@ class AppConfig {
|
|
|
77
79
|
projectData.path = path;
|
|
78
80
|
}
|
|
79
81
|
removeProject(id) {
|
|
80
|
-
if (
|
|
82
|
+
if (this.projects.length === 0) {
|
|
81
83
|
return;
|
|
82
84
|
}
|
|
83
85
|
this.projects = this.projects.filter((projectData) => {
|
|
84
86
|
return projectData.id !== id;
|
|
85
87
|
});
|
|
86
|
-
if (this.projects.length === 0) {
|
|
87
|
-
delete this.projects;
|
|
88
|
-
}
|
|
89
88
|
}
|
|
90
89
|
registerPreset(name, source, path) {
|
|
91
|
-
if (
|
|
92
|
-
|
|
90
|
+
if (source === Preset_1.PRESET_SOURCE_INTERNAL) {
|
|
91
|
+
return;
|
|
93
92
|
}
|
|
94
93
|
let presetData = this.presets.find((preset) => {
|
|
94
|
+
if (source === Preset_1.PRESET_SOURCE_EXTERNAL && preset.path === path) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
95
97
|
return preset.name === name;
|
|
96
98
|
});
|
|
97
99
|
if (!presetData) {
|
|
@@ -110,15 +112,12 @@ class AppConfig {
|
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
unregisterPreset(name) {
|
|
113
|
-
if (
|
|
115
|
+
if (this.presets.length === 0) {
|
|
114
116
|
return;
|
|
115
117
|
}
|
|
116
118
|
this.presets = this.presets.filter((preset) => {
|
|
117
119
|
return preset.name !== name;
|
|
118
120
|
});
|
|
119
|
-
if (this.presets.length === 0) {
|
|
120
|
-
delete this.presets;
|
|
121
|
-
}
|
|
122
121
|
}
|
|
123
122
|
hasMeta(name) {
|
|
124
123
|
if (!this.meta) {
|
|
@@ -168,30 +167,30 @@ class AppConfig {
|
|
|
168
167
|
delete this.env;
|
|
169
168
|
}
|
|
170
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* @deprecated
|
|
172
|
+
*/
|
|
171
173
|
toJson() {
|
|
172
|
-
|
|
174
|
+
return this.toObject();
|
|
175
|
+
}
|
|
176
|
+
toObject() {
|
|
177
|
+
return {
|
|
173
178
|
debug: this.debug,
|
|
174
179
|
logLevel: this.logLevel,
|
|
175
180
|
keystore: this.keystore,
|
|
176
181
|
plugins: this.plugins.length > 0 ? this.plugins : undefined,
|
|
177
|
-
|
|
178
|
-
|
|
182
|
+
presets: this.presets.length > 0 ? this.presets : undefined,
|
|
183
|
+
projects: this.projects.length > 0 ? this.projects : undefined,
|
|
179
184
|
env: this.env,
|
|
180
185
|
meta: this.meta
|
|
181
186
|
};
|
|
182
|
-
return Object.keys(json).reduce((res, key) => {
|
|
183
|
-
if (typeof json[key] !== "undefined") {
|
|
184
|
-
res[key] = json[key];
|
|
185
|
-
}
|
|
186
|
-
return res;
|
|
187
|
-
}, {});
|
|
188
187
|
}
|
|
189
188
|
toJsString() {
|
|
190
|
-
const json = JSON.stringify(this.
|
|
189
|
+
const json = JSON.stringify(this.toObject(), null, 4);
|
|
191
190
|
return `// Wocker config\nexports.config = ${json};`;
|
|
192
191
|
}
|
|
193
192
|
toString() {
|
|
194
|
-
return JSON.stringify(this.
|
|
193
|
+
return JSON.stringify(this.toObject(), null, 4);
|
|
195
194
|
}
|
|
196
195
|
}
|
|
197
196
|
exports.AppConfig = AppConfig;
|
package/lib/makes/FS.js
CHANGED
package/lib/makes/Preset.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type PresetVariableConfig = TextOption | ConfirmOption | SelectOption;
|
|
|
27
27
|
export type PresetProperties = PickProperties<Preset>;
|
|
28
28
|
export declare abstract class Preset {
|
|
29
29
|
name: string;
|
|
30
|
-
source?:
|
|
30
|
+
source?: PresetSource;
|
|
31
31
|
version: string;
|
|
32
32
|
type?: string;
|
|
33
33
|
image?: string;
|
|
@@ -42,12 +42,16 @@ export declare abstract class Preset {
|
|
|
42
42
|
volumes?: string[];
|
|
43
43
|
volumeOptions?: string[];
|
|
44
44
|
protected constructor(data: PresetProperties);
|
|
45
|
-
abstract save():
|
|
46
|
-
abstract delete():
|
|
45
|
+
abstract save(): void;
|
|
46
|
+
abstract delete(): void;
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated
|
|
49
|
+
*/
|
|
47
50
|
toJSON(): PresetProperties;
|
|
51
|
+
toObject(): PresetProperties;
|
|
48
52
|
}
|
|
49
|
-
export declare const PRESET_SOURCE_INTERNAL
|
|
50
|
-
export declare const PRESET_SOURCE_EXTERNAL
|
|
51
|
-
export declare const PRESET_SOURCE_GITHUB
|
|
52
|
-
export type
|
|
53
|
+
export declare const PRESET_SOURCE_INTERNAL: "internal";
|
|
54
|
+
export declare const PRESET_SOURCE_EXTERNAL: "external";
|
|
55
|
+
export declare const PRESET_SOURCE_GITHUB: "github";
|
|
56
|
+
export type PresetSource = typeof PRESET_SOURCE_INTERNAL | typeof PRESET_SOURCE_EXTERNAL | typeof PRESET_SOURCE_GITHUB;
|
|
53
57
|
export {};
|
package/lib/makes/Preset.js
CHANGED
|
@@ -15,18 +15,21 @@ class Preset {
|
|
|
15
15
|
this.volumes = data.volumes;
|
|
16
16
|
this.volumeOptions = data.volumeOptions;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated
|
|
20
|
+
*/
|
|
19
21
|
toJSON() {
|
|
22
|
+
return this.toObject();
|
|
23
|
+
}
|
|
24
|
+
toObject() {
|
|
20
25
|
return {
|
|
21
26
|
name: this.name,
|
|
22
27
|
version: this.version,
|
|
23
28
|
type: this.type,
|
|
24
|
-
source: this.source,
|
|
25
29
|
image: this.image,
|
|
26
30
|
dockerfile: this.dockerfile,
|
|
27
31
|
buildArgsOptions: this.buildArgsOptions,
|
|
28
32
|
envOptions: this.envOptions,
|
|
29
|
-
path: this.path,
|
|
30
33
|
volumes: this.volumes,
|
|
31
34
|
volumeOptions: this.volumeOptions
|
|
32
35
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppConfig } from "../makes";
|
|
1
|
+
import { AppConfig, PresetSource } from "../makes";
|
|
2
2
|
export declare abstract class AppConfigService {
|
|
3
3
|
abstract get config(): AppConfig;
|
|
4
4
|
get version(): string;
|
|
@@ -13,5 +13,7 @@ export declare abstract class AppConfigService {
|
|
|
13
13
|
getConfig(): AppConfig;
|
|
14
14
|
addProject(id: string, name: string, path: string): void;
|
|
15
15
|
removeProject(id: string): void;
|
|
16
|
+
registerPreset(name: string, source: PresetSource, path?: string): void;
|
|
17
|
+
unregisterPreset(name: string): void;
|
|
16
18
|
save(): void;
|
|
17
19
|
}
|
|
@@ -33,9 +33,19 @@ let AppConfigService = class AppConfigService {
|
|
|
33
33
|
}
|
|
34
34
|
addProject(id, name, path) {
|
|
35
35
|
this.config.addProject(id, name, path);
|
|
36
|
+
this.config.save();
|
|
36
37
|
}
|
|
37
38
|
removeProject(id) {
|
|
38
39
|
this.config.removeProject(id);
|
|
40
|
+
this.config.save();
|
|
41
|
+
}
|
|
42
|
+
registerPreset(name, source, path) {
|
|
43
|
+
this.config.registerPreset(name, source, path);
|
|
44
|
+
this.save();
|
|
45
|
+
}
|
|
46
|
+
unregisterPreset(name) {
|
|
47
|
+
this.config.unregisterPreset(name);
|
|
48
|
+
this.config.save();
|
|
39
49
|
}
|
|
40
50
|
save() {
|
|
41
51
|
this.config.save();
|
package/package.json
CHANGED