@kawalir/extension-node 0.6.7 → 2.0.2
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/CHANGELOG.md +22 -1
- package/Core/Classes/FileSystem/JsonFile.ts +1 -1
- package/Core/Classes/FileSystem/TextFile.ts +1 -1
- package/Core/Functions/Console/ConsoleFunctions.ts +5 -0
- package/{Global/Methods/Console/index.ts → Core/Functions/Console/Read/ConsoleReadFunctions.ts} +4 -5
- package/Core/Functions/Console/Read/index.ts +1 -0
- package/Core/Functions/Console/index.ts +1 -0
- package/Core/Functions/File/File/FileFunctions.ts +1 -1
- package/Core/Functions/Node/NodeFunctions.ts +6 -0
- package/Core/Functions/Node/index.ts +1 -0
- package/Core/Functions/index.ts +2 -0
- package/Global/Kawalir.Node.d.ts +12 -0
- package/Global/index.ts +5 -3
- package/index.d.ts +4 -3
- package/package.json +2 -2
- package/Global/Classes/GlobalClasses.d.ts +0 -18
- package/Global/Classes/index.ts +0 -9
- package/Global/Methods/Console/Console.d.ts +0 -7
- package/Global/Methods/index.ts +0 -1
- package/Global/Modules/GlobalModules.d.ts +0 -8
- package/Global/Modules/index.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
# New
|
|
2
|
+
|
|
3
|
+
Central object and namespace `Kawalir` holding all functions and types
|
|
4
|
+
|
|
5
|
+
# Breaking Changes
|
|
6
|
+
|
|
7
|
+
## Dependencies
|
|
8
|
+
|
|
9
|
+
Update to @kawalir/extension@2.0.2 with its **big list** of breaking changes (see CHANGELOG.md [here](https://www.npmjs.com/package/@kawalir/extension/v/2.0.0?activeTab=code))
|
|
10
|
+
|
|
11
|
+
## Removed/Moved
|
|
12
|
+
|
|
13
|
+
- Methods
|
|
14
|
+
- `Console.ReadLine` -> `Kawalir.Console.Read.line`
|
|
15
|
+
- Global objects
|
|
16
|
+
- `Path` -> `Kawalir.Node.Path`
|
|
17
|
+
- `FileSystem` -> `Kawalir.Node.FileSystem`
|
|
18
|
+
- `Process` -> `Kawalir.Process`
|
|
19
|
+
- The following globally available classes are no longer globally available and need to be imported instead:
|
|
20
|
+
- `Folder`
|
|
21
|
+
- `TextFile`
|
|
22
|
+
- `JsonFile`
|
|
@@ -11,7 +11,7 @@ export class JsonFile<T> extends File {
|
|
|
11
11
|
public write = (data: T, pretty: boolean = true) =>
|
|
12
12
|
this.textFile.write(JSON.stringify(data, null, pretty ? 2 : undefined));
|
|
13
13
|
|
|
14
|
-
public readOrNull = (): Nullable<T> =>
|
|
14
|
+
public readOrNull = (): Kawalir.Nullable<T> =>
|
|
15
15
|
this.testExistence() ? this.read() : null;
|
|
16
16
|
|
|
17
17
|
public read = (): T => JSON.parse(this.textFile.read());
|
|
@@ -6,7 +6,7 @@ export class TextFile extends File {
|
|
|
6
6
|
|
|
7
7
|
public write = (content: string) => FF.File.write(this.path, content);
|
|
8
8
|
|
|
9
|
-
public readOrNull = (): StringOrNull => FF.File.readOrNull(this.path);
|
|
9
|
+
public readOrNull = (): Kawalir.StringOrNull => FF.File.readOrNull(this.path);
|
|
10
10
|
|
|
11
11
|
public read = (): string => FF.File.read(this.path);
|
|
12
12
|
}
|
package/{Global/Methods/Console/index.ts → Core/Functions/Console/Read/ConsoleReadFunctions.ts}
RENAMED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ReadLine } from "@kawalir/extension-node/External";
|
|
2
|
-
import { ObjectExtender } from "@kawalir/extension/Core";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export class ConsoleReadFunctions {
|
|
4
|
+
public static line = async (prompt?: string): Promise<string> => {
|
|
6
5
|
const int = ReadLine.createInterface(process.stdin, process.stdout);
|
|
7
6
|
const answer = await int.question(prompt ?? "");
|
|
8
7
|
int.close();
|
|
9
8
|
return answer;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ConsoleReadFunctions";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ConsoleFunctions";
|
|
@@ -20,7 +20,7 @@ export class FileFunctions {
|
|
|
20
20
|
force: true,
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
public static readOrNull = (path: string): StringOrNull =>
|
|
23
|
+
public static readOrNull = (path: string): Kawalir.StringOrNull =>
|
|
24
24
|
this.testExistence(path) ? this.read(path) : null;
|
|
25
25
|
|
|
26
26
|
public static read = (path: string): string => FS.readFileSync(path, "utf-8");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./NodeFunctions";
|
package/Core/Functions/index.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as KAW from "@kawalir/extension/Kawalir";
|
|
2
|
+
import * as CORE from "../Core";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
var Kawalir: KAW.Kawalir & {
|
|
6
|
+
Node: typeof CORE.NodeFunctions;
|
|
7
|
+
Console: typeof CORE.ConsoleFunctions;
|
|
8
|
+
Process: typeof CORE.ProcessFunctions;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export {};
|
package/Global/index.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference path="../extension/index.d.ts" />
|
|
2
2
|
|
|
3
3
|
//? [Global]
|
|
4
|
-
/// <reference path="Global/
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
/// <reference path="Global/Kawalir.Node.d.ts" />
|
|
5
|
+
|
|
6
|
+
//? [Exports]
|
|
7
|
+
export * from "./Core";
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"Node",
|
|
8
8
|
"Node Extension"
|
|
9
9
|
],
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "2.0.2",
|
|
11
11
|
"author": "Denis Mijatovic",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"type": "commonjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"watch-test": "cd Test && npm start"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@kawalir/extension": "^0.
|
|
33
|
+
"@kawalir/extension": "^2.0.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^25.3.0"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as CORE from "@kawalir/extension-node/Core";
|
|
2
|
-
|
|
3
|
-
declare global {
|
|
4
|
-
//? Static
|
|
5
|
-
var Process: typeof CORE.ProcessFunctions;
|
|
6
|
-
|
|
7
|
-
//? Proper classses
|
|
8
|
-
interface TextFile extends CORE.TextFile {}
|
|
9
|
-
var TextFile: typeof CORE.TextFile;
|
|
10
|
-
|
|
11
|
-
interface JsonFile<T> extends CORE.JsonFile<T> {}
|
|
12
|
-
var JsonFile: typeof CORE.JsonFile;
|
|
13
|
-
|
|
14
|
-
interface Folder extends CORE.Folder {}
|
|
15
|
-
var Folder: typeof CORE.Folder;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export {};
|
package/Global/Classes/index.ts
DELETED
package/Global/Methods/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./Console";
|
package/Global/Modules/index.ts
DELETED