@wocker/core 1.0.21-beta.2 → 1.0.21
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/makes/AppConfig.d.ts +1 -0
- package/lib/makes/AppConfig.js +6 -0
- package/lib/makes/FS.d.ts +3 -0
- package/lib/makes/FS.js +3 -0
- package/lib/makes/FSManager.d.ts +6 -9
- package/lib/makes/FSManager.js +5 -39
- package/lib/makes/FileSystem.d.ts +4 -4
- package/lib/makes/FileSystem.js +2 -18
- package/lib/makes/FileSystemManager.d.ts +10 -0
- package/lib/makes/FileSystemManager.js +24 -0
- package/lib/makes/index.d.ts +1 -0
- package/lib/makes/index.js +1 -0
- package/lib/services/DockerService.d.ts +2 -0
- package/lib/services/PluginConfigService.d.ts +4 -1
- package/lib/services/PluginConfigService.js +11 -3
- package/package.json +1 -1
- package/lib/services/AppFileSystem.d.ts +0 -3
- package/lib/services/AppFileSystem.js +0 -7
package/lib/makes/AppConfig.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare abstract class AppConfig {
|
|
|
31
31
|
removeProject(id: string): void;
|
|
32
32
|
registerPreset(name: string, source: PresetType, path?: string): void;
|
|
33
33
|
unregisterPreset(name: string): void;
|
|
34
|
+
hasMeta(name: string): boolean;
|
|
34
35
|
getMeta(name: string): string | undefined;
|
|
35
36
|
getMeta(name: string, defaultValue: string): string;
|
|
36
37
|
setMeta(name: string, value: string): void;
|
package/lib/makes/AppConfig.js
CHANGED
|
@@ -99,6 +99,12 @@ class AppConfig {
|
|
|
99
99
|
delete this.presets;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
+
hasMeta(name) {
|
|
103
|
+
if (!this.meta) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return name in this.meta;
|
|
107
|
+
}
|
|
102
108
|
getMeta(name, defaultValue) {
|
|
103
109
|
if (!this.meta || !(name in this.meta)) {
|
|
104
110
|
return defaultValue;
|
package/lib/makes/FS.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ type ReadFileOptions = Abortable & {
|
|
|
4
4
|
encoding?: BufferEncoding;
|
|
5
5
|
flag?: string;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
7
10
|
export declare class FS {
|
|
8
11
|
static mkdir(path: PathLike, options?: MakeDirectoryOptions): Promise<unknown>;
|
|
9
12
|
static readFile(filePath: PathOrFileDescriptor, options?: ReadFileOptions): Promise<string | Buffer>;
|
package/lib/makes/FS.js
CHANGED
|
@@ -48,6 +48,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
48
48
|
exports.FS = void 0;
|
|
49
49
|
const fs_1 = __importDefault(require("fs"));
|
|
50
50
|
const Path = __importStar(require("path"));
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated
|
|
53
|
+
*/
|
|
51
54
|
class FS {
|
|
52
55
|
static mkdir(path, options) {
|
|
53
56
|
return __awaiter(this, void 0, void 0, function* () {
|
package/lib/makes/FSManager.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import fs, { createReadStream,
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import fs, { createReadStream, RmOptions } from "fs";
|
|
2
|
+
import { FileSystemManager } from "./FileSystemManager";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated
|
|
5
|
+
*/
|
|
6
|
+
export declare class FSManager extends FileSystemManager {
|
|
7
7
|
path(...parts: string[]): string;
|
|
8
|
-
mkdir(path: string, options?: MakeDirectoryOptions): Promise<unknown>;
|
|
9
8
|
readdir(path: string): Promise<string[]>;
|
|
10
|
-
exists(path: string): boolean;
|
|
11
|
-
copy(path: string): Promise<void>;
|
|
12
9
|
readJSON(path: string): Promise<any>;
|
|
13
10
|
writeJSON(path: string, data: any): Promise<void>;
|
|
14
11
|
rm(path: string, options?: RmOptions): Promise<unknown>;
|
package/lib/makes/FSManager.js
CHANGED
|
@@ -44,29 +44,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.FSManager = void 0;
|
|
46
46
|
const fs_1 = __importStar(require("fs"));
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
47
|
+
const FileSystemManager_1 = require("./FileSystemManager");
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated
|
|
50
|
+
*/
|
|
51
|
+
class FSManager extends FileSystemManager_1.FileSystemManager {
|
|
53
52
|
path(...parts) {
|
|
54
53
|
return this.destination.path(...parts);
|
|
55
54
|
}
|
|
56
|
-
mkdir(path_1) {
|
|
57
|
-
return __awaiter(this, arguments, void 0, function* (path, options = {}) {
|
|
58
|
-
const fullPath = this.path(path);
|
|
59
|
-
return new Promise((resolve, reject) => {
|
|
60
|
-
(0, fs_1.mkdir)(fullPath, options, (err) => {
|
|
61
|
-
if (err) {
|
|
62
|
-
reject(err);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
resolve(undefined);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
55
|
readdir(path) {
|
|
71
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
57
|
const filePath = this.path(path);
|
|
@@ -81,25 +66,6 @@ class FSManager {
|
|
|
81
66
|
});
|
|
82
67
|
});
|
|
83
68
|
}
|
|
84
|
-
exists(path) {
|
|
85
|
-
const fullPath = this.path(path);
|
|
86
|
-
return (0, fs_1.existsSync)(fullPath);
|
|
87
|
-
}
|
|
88
|
-
copy(path) {
|
|
89
|
-
const destination = this.path(path);
|
|
90
|
-
if ((0, fs_1.existsSync)(destination)) {
|
|
91
|
-
return Promise.resolve();
|
|
92
|
-
}
|
|
93
|
-
return new Promise((resolve, reject) => {
|
|
94
|
-
(0, fs_1.copyFile)(this.source.path(path), destination, (err) => {
|
|
95
|
-
if (err) {
|
|
96
|
-
reject(err);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
resolve(undefined);
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
69
|
readJSON(path) {
|
|
104
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
71
|
const filePath = this.path(path);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import fs, { RmOptions, Stats, WriteFileOptions } from "fs";
|
|
1
|
+
import fs, { RmOptions, Stats, WriteFileOptions, MakeDirectoryOptions } from "fs";
|
|
2
2
|
type ReaddirOptions = fs.ObjectEncodingOptions & {
|
|
3
3
|
recursive?: boolean | undefined;
|
|
4
4
|
};
|
|
@@ -9,14 +9,14 @@ export declare class FileSystem {
|
|
|
9
9
|
basename(...parts: string[]): string;
|
|
10
10
|
exists(...parts: string[]): boolean;
|
|
11
11
|
stat(...parts: string[]): Stats;
|
|
12
|
-
mkdir(path?: string, options?:
|
|
12
|
+
mkdir(path?: string, options?: MakeDirectoryOptions): void;
|
|
13
13
|
readdir(...parts: string[]): Promise<string[]>;
|
|
14
14
|
readdirFiles(path?: string, options?: ReaddirOptions): Promise<string[]>;
|
|
15
|
-
readFile(path: string): Buffer
|
|
15
|
+
readFile(path: string): Buffer;
|
|
16
16
|
readJSON(...paths: string[]): any;
|
|
17
17
|
writeFile(path: string, data: string | Buffer | NodeJS.ArrayBufferView, options?: fs.WriteFileOptions): Promise<void>;
|
|
18
18
|
writeJSON(path: string, data: any, options?: WriteFileOptions): void;
|
|
19
|
-
rm(path: string, options?: RmOptions):
|
|
19
|
+
rm(path: string, options?: RmOptions): void;
|
|
20
20
|
createWriteStream(path: string, options?: BufferEncoding): fs.WriteStream;
|
|
21
21
|
createReadStream(path: string, options?: BufferEncoding): fs.ReadStream;
|
|
22
22
|
}
|
package/lib/makes/FileSystem.js
CHANGED
|
@@ -136,24 +136,8 @@ class FileSystem {
|
|
|
136
136
|
fs_1.default.writeFileSync(fullPath, json, options);
|
|
137
137
|
}
|
|
138
138
|
rm(path, options) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return new Promise((resolve, reject) => {
|
|
142
|
-
const callback = (err) => {
|
|
143
|
-
if (err) {
|
|
144
|
-
reject(err);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
resolve(undefined);
|
|
148
|
-
};
|
|
149
|
-
if (options) {
|
|
150
|
-
fs_1.default.rm(fullPath, options, callback);
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
fs_1.default.rm(fullPath, callback);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
});
|
|
139
|
+
const fullPath = this.path(path);
|
|
140
|
+
fs_1.default.rmdirSync(fullPath, options);
|
|
157
141
|
}
|
|
158
142
|
createWriteStream(path, options) {
|
|
159
143
|
return fs_1.default.createWriteStream(this.path(path), options);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MakeDirectoryOptions, CopySyncOptions } from "fs";
|
|
2
|
+
import { FileSystem } from "./FileSystem";
|
|
3
|
+
export declare class FileSystemManager {
|
|
4
|
+
readonly source: FileSystem;
|
|
5
|
+
readonly destination: FileSystem;
|
|
6
|
+
constructor(source: string, destination: string);
|
|
7
|
+
exists(...parts: string[]): boolean;
|
|
8
|
+
mkdir(path: string, options?: MakeDirectoryOptions): void;
|
|
9
|
+
copy(path: string, options?: CopySyncOptions): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
exports.FileSystemManager = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const FileSystem_1 = require("./FileSystem");
|
|
9
|
+
class FileSystemManager {
|
|
10
|
+
constructor(source, destination) {
|
|
11
|
+
this.source = new FileSystem_1.FileSystem(source);
|
|
12
|
+
this.destination = new FileSystem_1.FileSystem(destination);
|
|
13
|
+
}
|
|
14
|
+
exists(...parts) {
|
|
15
|
+
return this.destination.exists(...parts);
|
|
16
|
+
}
|
|
17
|
+
mkdir(path, options) {
|
|
18
|
+
this.destination.mkdir(path, options);
|
|
19
|
+
}
|
|
20
|
+
copy(path, options) {
|
|
21
|
+
fs_1.default.cpSync(this.source.path(path), this.destination.path(path), options);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.FileSystemManager = FileSystemManager;
|
package/lib/makes/index.d.ts
CHANGED
package/lib/makes/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __exportStar(require("./AppConfig"), exports);
|
|
|
18
18
|
__exportStar(require("./Config"), exports);
|
|
19
19
|
__exportStar(require("./ConfigCollection"), exports);
|
|
20
20
|
__exportStar(require("./FileSystem"), exports);
|
|
21
|
+
__exportStar(require("./FileSystemManager"), exports);
|
|
21
22
|
__exportStar(require("./FS"), exports);
|
|
22
23
|
__exportStar(require("./FSManager"), exports);
|
|
23
24
|
__exportStar(require("./Logger"), exports);
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { WriteFileOptions, MakeDirectoryOptions, RmOptions, WriteStream, ReadStream } from "fs";
|
|
2
|
+
import { AppConfigService } from "./AppConfigService";
|
|
2
3
|
import { FileSystem } from "../makes";
|
|
3
4
|
export declare class PluginConfigService {
|
|
5
|
+
protected readonly appConfigService: AppConfigService;
|
|
4
6
|
protected readonly pluginDir: string;
|
|
5
7
|
protected _fs?: FileSystem;
|
|
6
|
-
constructor(pluginDir: string);
|
|
8
|
+
constructor(appConfigService: AppConfigService, pluginDir: string);
|
|
7
9
|
get fs(): FileSystem;
|
|
10
|
+
isVersionGTE(version: string): boolean;
|
|
8
11
|
/** @deprecated */
|
|
9
12
|
dataPath(...parts: string[]): string;
|
|
10
13
|
/** @deprecated */
|
|
@@ -22,11 +22,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.PluginConfigService = void 0;
|
|
25
|
+
const AppConfigService_1 = require("./AppConfigService");
|
|
25
26
|
const makes_1 = require("../makes");
|
|
26
27
|
const decorators_1 = require("../decorators");
|
|
27
28
|
const env_1 = require("../env");
|
|
28
29
|
let PluginConfigService = class PluginConfigService {
|
|
29
|
-
constructor(pluginDir) {
|
|
30
|
+
constructor(appConfigService, pluginDir) {
|
|
31
|
+
this.appConfigService = appConfigService;
|
|
30
32
|
this.pluginDir = pluginDir;
|
|
31
33
|
}
|
|
32
34
|
get fs() {
|
|
@@ -41,6 +43,12 @@ let PluginConfigService = class PluginConfigService {
|
|
|
41
43
|
}
|
|
42
44
|
return this._fs;
|
|
43
45
|
}
|
|
46
|
+
isVersionGTE(version) {
|
|
47
|
+
if (!this.appConfigService.isVersionGTE) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return this.appConfigService.isVersionGTE(version);
|
|
51
|
+
}
|
|
44
52
|
/** @deprecated */
|
|
45
53
|
dataPath(...parts) {
|
|
46
54
|
return this.fs.path(...parts);
|
|
@@ -91,6 +99,6 @@ let PluginConfigService = class PluginConfigService {
|
|
|
91
99
|
exports.PluginConfigService = PluginConfigService;
|
|
92
100
|
exports.PluginConfigService = PluginConfigService = __decorate([
|
|
93
101
|
(0, decorators_1.Injectable)(),
|
|
94
|
-
__param(
|
|
95
|
-
__metadata("design:paramtypes", [String])
|
|
102
|
+
__param(1, (0, decorators_1.Inject)(env_1.PLUGIN_DIR_KEY)),
|
|
103
|
+
__metadata("design:paramtypes", [AppConfigService_1.AppConfigService, String])
|
|
96
104
|
], PluginConfigService);
|
package/package.json
CHANGED