@webtypen/webframez-core 0.1.5 → 0.1.7

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.
@@ -6,7 +6,6 @@ export declare class ConsoleCommand {
6
6
  static description?: string;
7
7
  rl: readline.Interface | null;
8
8
  currentProgress: ConsoleProgressBar | null;
9
- constructor();
10
9
  handle(): Promise<void>;
11
10
  handleSystem(): Promise<void>;
12
11
  finallySystem(): Promise<void>;
@@ -18,17 +18,18 @@ const readline_1 = __importDefault(require("readline"));
18
18
  const ConsoleProgressBar_1 = require("./ConsoleProgressBar");
19
19
  class ConsoleCommand {
20
20
  constructor() {
21
+ this.rl = null;
21
22
  this.currentProgress = null;
22
- this.rl = readline_1.default.createInterface({
23
- input: process.stdin,
24
- output: process.stdout,
25
- });
26
23
  }
27
24
  handle() {
28
25
  return __awaiter(this, void 0, void 0, function* () { });
29
26
  }
30
27
  handleSystem() {
31
28
  return __awaiter(this, void 0, void 0, function* () {
29
+ this.rl = readline_1.default.createInterface({
30
+ input: process.stdin,
31
+ output: process.stdout,
32
+ });
32
33
  try {
33
34
  yield this.handle();
34
35
  }
@@ -56,13 +57,16 @@ class ConsoleCommand {
56
57
  return this;
57
58
  }
58
59
  ask(question) {
59
- return new Promise((resolve) => {
60
- if (this.rl) {
61
- this.rl.question(question, (answer) => {
62
- resolve(answer);
63
- });
64
- }
65
- resolve(null);
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ const result = yield new Promise((resolve) => {
62
+ if (this.rl) {
63
+ this.rl.question(question, (answer) => {
64
+ resolve(answer);
65
+ });
66
+ }
67
+ resolve(null);
68
+ });
69
+ return result;
66
70
  });
67
71
  }
68
72
  progress(count) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-core",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "The core package of the typescript based webframez (web-framework) by webtypen.de",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "license": "MIT",
@@ -6,19 +6,17 @@ export class ConsoleCommand {
6
6
  static signature: string;
7
7
  static description?: string;
8
8
 
9
- rl: readline.Interface | null;
9
+ rl: readline.Interface | null = null;
10
10
  currentProgress: ConsoleProgressBar | null = null;
11
11
 
12
- constructor() {
12
+ async handle() {}
13
+
14
+ async handleSystem() {
13
15
  this.rl = readline.createInterface({
14
16
  input: process.stdin,
15
17
  output: process.stdout,
16
18
  });
17
- }
18
19
 
19
- async handle() {}
20
-
21
- async handleSystem() {
22
20
  try {
23
21
  await this.handle();
24
22
  } catch (e) {
@@ -44,8 +42,8 @@ export class ConsoleCommand {
44
42
  return this;
45
43
  }
46
44
 
47
- ask(question: string) {
48
- return new Promise((resolve) => {
45
+ async ask(question: string) {
46
+ const result = await new Promise((resolve) => {
49
47
  if (this.rl) {
50
48
  this.rl.question(question, (answer) => {
51
49
  resolve(answer);
@@ -53,6 +51,7 @@ export class ConsoleCommand {
53
51
  }
54
52
  resolve(null);
55
53
  });
54
+ return result;
56
55
  }
57
56
 
58
57
  progress(count: number) {