@wocker/core 1.0.22-beta.1 → 1.0.22-beta.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.
@@ -1,5 +1,5 @@
1
1
  import "reflect-metadata";
2
2
  import { Option as O } from "@kearisp/cli";
3
- type AliasOrParams = string | Omit<O, "name">;
3
+ type AliasOrParams = string | Partial<Omit<O, "name">>;
4
4
  export declare const Option: (name: string, params?: AliasOrParams) => ParameterDecorator;
5
5
  export {};
@@ -46,7 +46,7 @@ export declare abstract class AppConfig {
46
46
  getEnv(name: string, defaultValue: string): string;
47
47
  setEnv(name: string, value: string): void;
48
48
  unsetEnv(name: string): void;
49
- abstract save(): Promise<void>;
49
+ abstract save(): void;
50
50
  toJson(): AppConfigProperties;
51
51
  toJsString(): string;
52
52
  toString(): string;
@@ -10,7 +10,7 @@ export declare class FileSystem {
10
10
  exists(...parts: string[]): boolean;
11
11
  stat(...parts: string[]): Stats;
12
12
  mkdir(path?: string, options?: MakeDirectoryOptions): void;
13
- readdir(...parts: string[]): Promise<string[]>;
13
+ readdir(path: string): string[];
14
14
  readdirFiles(path?: string, options?: ReaddirOptions): Promise<string[]>;
15
15
  readFile(path: string): Buffer;
16
16
  readJSON(...paths: string[]): any;
@@ -70,20 +70,9 @@ class FileSystem {
70
70
  const fullPath = this.path(path);
71
71
  fs_1.default.mkdirSync(fullPath, options);
72
72
  }
73
- readdir(...parts) {
74
- return __awaiter(this, void 0, void 0, function* () {
75
- const fullPath = this.path(...parts);
76
- return new Promise((resolve, reject) => {
77
- const callback = (err, files) => {
78
- if (err) {
79
- reject(err);
80
- return;
81
- }
82
- resolve(files);
83
- };
84
- fs_1.default.readdir(fullPath, callback);
85
- });
86
- });
73
+ readdir(path) {
74
+ const fullPath = this.path(path);
75
+ return fs_1.default.readdirSync(fullPath);
87
76
  }
88
77
  readdirFiles() {
89
78
  return __awaiter(this, arguments, void 0, function* (path = "", options) {
@@ -43,7 +43,7 @@ export declare abstract class Project {
43
43
  abstract getSecret(key: string, byDefault: string): Promise<string>;
44
44
  abstract getSecret(key: string, byDefault?: string): Promise<string | undefined>;
45
45
  abstract setSecret(key: string, value: string): Promise<void>;
46
- abstract save(): Promise<void>;
46
+ abstract save(): void;
47
47
  toJSON(): ProjectProperties;
48
48
  }
49
49
  export declare const PROJECT_TYPE_DOCKERFILE = "dockerfile";
@@ -11,4 +11,7 @@ export declare abstract class AppConfigService {
11
11
  * @deprecated
12
12
  */
13
13
  getConfig(): AppConfig;
14
+ addProject(id: string, name: string, path: string): void;
15
+ removeProject(id: string): void;
16
+ save(): void;
14
17
  }
@@ -31,6 +31,15 @@ let AppConfigService = class AppConfigService {
31
31
  getConfig() {
32
32
  return this.config;
33
33
  }
34
+ addProject(id, name, path) {
35
+ this.config.addProject(id, name, path);
36
+ }
37
+ removeProject(id) {
38
+ this.config.removeProject(id);
39
+ }
40
+ save() {
41
+ this.config.save();
42
+ }
34
43
  };
35
44
  exports.AppConfigService = AppConfigService;
36
45
  exports.AppConfigService = AppConfigService = __decorate([
@@ -78,7 +78,7 @@ let PluginConfigService = class PluginConfigService {
78
78
  /** @deprecated */
79
79
  rm(path, options) {
80
80
  return __awaiter(this, void 0, void 0, function* () {
81
- yield this.fs.rm(path, options);
81
+ this.fs.rm(path, options);
82
82
  });
83
83
  }
84
84
  /** @deprecated */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wocker/core",
3
- "version": "1.0.22-beta.1",
3
+ "version": "1.0.22-beta.3",
4
4
  "author": "Kris Papercut <krispcut@gmail.com>",
5
5
  "description": "Core of the Wocker",
6
6
  "license": "MIT",
@@ -37,6 +37,7 @@
37
37
  "@types/node": "^22.15.3",
38
38
  "jest": "^29.7.0",
39
39
  "make-coverage-badge": "^1.2.0",
40
+ "memfs": "^4.17.1",
40
41
  "ts-jest": "^29.3.2",
41
42
  "ts-node": "^10.9.2",
42
43
  "typescript": "^5.8.3"
package/test/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ import {jest} from "@jest/globals";
2
+ import {vol} from "memfs";
3
+
4
+
5
+ jest.mock("fs", () => vol);
6
+ jest.mock("fs/promises", () => vol.promises);