@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 CHANGED
@@ -1 +1,22 @@
1
- Dependencies update
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
  }
@@ -0,0 +1,5 @@
1
+ import { ConsoleReadFunctions } from "./Read";
2
+
3
+ export class ConsoleFunctions {
4
+ public static Read = ConsoleReadFunctions;
5
+ }
@@ -1,11 +1,10 @@
1
1
  import { ReadLine } from "@kawalir/extension-node/External";
2
- import { ObjectExtender } from "@kawalir/extension/Core";
3
2
 
4
- new ObjectExtender(console).add({
5
- ReadLine: async (prompt) => {
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,6 @@
1
+ import * as EXT from "@kawalir/extension-node/External";
2
+
3
+ export class NodeFunctions {
4
+ public static Path = EXT.Path;
5
+ public static FileSystem = EXT.FileSystem;
6
+ }
@@ -0,0 +1 @@
1
+ export * from "./NodeFunctions";
@@ -1,2 +1,4 @@
1
+ export * from "./Console";
1
2
  export * from "./File";
3
+ export * from "./Node";
2
4
  export * from "./Process";
@@ -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
@@ -1,3 +1,5 @@
1
- import "./Modules";
2
- import "./Classes";
3
- import "./Methods";
1
+ import * as CORE from "../Core";
2
+
3
+ Kawalir.Node = CORE.NodeFunctions;
4
+ Kawalir.Console = CORE.ConsoleFunctions;
5
+ Kawalir.Process = CORE.ProcessFunctions;
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/Classes/GlobalClasses.d.ts" />
5
- /// <reference path="Global/Modules/GlobalModules.d.ts" />
6
- /// <reference path="Global/Methods/Console/Console.d.ts" />
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.6.7",
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.8.4"
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 {};
@@ -1,9 +0,0 @@
1
- import * as CORE from "@kawalir/extension-node/Core";
2
-
3
- //? Static
4
- globalThis.Process = CORE.ProcessFunctions;
5
-
6
- //? Proper classses
7
- globalThis.TextFile = CORE.TextFile;
8
- globalThis.JsonFile = CORE.JsonFile;
9
- globalThis.Folder = CORE.Folder;
@@ -1,7 +0,0 @@
1
- declare global {
2
- interface Console {
3
- ReadLine(prompt?: string): Promise<string>;
4
- }
5
- }
6
-
7
- export {};
@@ -1 +0,0 @@
1
- import "./Console";
@@ -1,8 +0,0 @@
1
- import * as EXT from "@kawalir/extension-node/External";
2
-
3
- declare global {
4
- var Path: typeof EXT.Path;
5
- var FileSystem: typeof EXT.FileSystem;
6
- }
7
-
8
- export {};
@@ -1,4 +0,0 @@
1
- import * as EXT from "@kawalir/extension-node/External";
2
-
3
- globalThis.Path = EXT.Path;
4
- globalThis.FileSystem = EXT.FileSystem;